Solved

Drive empty

Posted on 1998-06-25
2
200 Views
Last Modified: 2010-05-03
I want to check my CD ROM drive is EMPTY or not
if EMPTY prompt error !
0
Comment
Question by:hateli
2 Comments
 
LVL 2

Accepted Solution

by:
swilt earned 10 total points
ID: 1464268
Try this bit of code

Option Explicit

Private Sub Form_Load()
    Dim x As Integer
   
    x = nCheckDrive("e:")
    If x = 0 Then
        MsgBox "Disk in drive"
    Else
        MsgBox "No Disk in drive"
    End If
End Sub

Private Function nCheckDrive(ByVal sDrive As String) As Integer
    On Error GoTo EHDrive
   
    Dim nErrNum As Integer
   
    nErrNum = 0
    Dir$ sDrive
    nCheckDrive = nErrNum
    Exit Function
   
EHDrive:
    nErrNum = Err.Number
   ' MsgBox Err.Description
    Resume Next
End Function

0
 
LVL 6

Expert Comment

by:clifABB
ID: 1464269
swilt:
An excellent solution.  Without even using the API!
My hats off to you.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying 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

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

685 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