Solved

Checking disk in drive A:

Posted on 1998-07-29
3
132 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now