Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I check to see if drive (A:, D:, etc) is ready before moving along?

How To

How do I check to see if drive (A:, D:, etc) is ready before moving along?

by  cghoga  Posted    (Edited  )
Sometimes it is useful when writing to a floppy or CD to verify that the media is inserted before moving along.
Otherwise, Access will give a nasty looking message.

To verify that a floppy has been inserted into the A: drive use the following code:

Dim fs, d

Set fs = CreateObject("Scripting.FileSystemObject")
Set d = fs.GetDrive("A:")
If d.IsReady Then
'Begin code execution here.
Else
MsgBox "A: drive is empty. Please insert disk."
End If

To verify that the CD drive is ready simply replace A: in the above code with the corresponding drive letter (most cases D:).

Hope this is a help to someone.
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top