Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Checking disk in drive A:

Posted on 1998-07-29
3
135 Views
Last Modified: 2012-05-04
I would like a VB code for the following pseudo code
 
 if no disk in drive A them
   msgBox ..
 end if

 if disk has problem(like unformated or damaged) then
    msgBox ..
 end if
0
Comment
Question by:g6yassin
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
anthonyc earned 20 total points
ID: 1467086
try this:

on local error resume next
dim bAgain as boolean

do
  filecopy "c:\winnt\notepad.exe", "a:\notepad.exe"
  select case err
  case 71
     msgbox "Place a disk in drive A and try again"
     bAgain = true
  case 0
     bAgain = false
  case else
     msgbox error$
     bAgain = true
  end select
  err = 0
loop until not bAgain
0
 

Expert Comment

by:subhashgarg
ID: 1467087
How about
on error go to handle_err:

chdrive "a"
handle_err:
 if err = 68 then 'device unavailable
    msgbox

0
 
LVL 6

Expert Comment

by:anthonyc
ID: 1467088
that'll work too... Filecopy was just an example of the operation he was goign to perform.   I wouldn't use IF though.. Select Case is faster.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question