Solved

unavailable device

Posted on 2000-04-20
3
222 Views
Last Modified: 2010-05-02
I have a drive listbox and when I choose the a:\ drive I get an error saying unavailable device. I know that that is because I do not have anything in the drive. I just want some error handling to prevent the debug message. I would like the listbox to default to my c instead.  Can someone help?
0
Comment
Question by:WCOLEMAN01
3 Comments
 
LVL 9

Accepted Solution

by:
Dalin earned 70 total points
ID: 2734855

On Error goto trap
ChDrive "a:"

Trap:
Select Case Err.Number
Case 68

ChDrive "C:"
Case else
'Other error
End select
0
 

Expert Comment

by:Cuervo
ID: 2734864
Suppose we have a Drive combo called "Drive1" and a fileList called "File1" (that will change to the drive exposed in the "Drive1" control)

Check this code:

Private Sub Drive1_Change()

On Error Resume Next    'If there is an error, continue

File1.Path = Drive1.Drive

If Err.Number = 68 Then  'Check for an error
    MsgBox "Drive not prepared"
End If

End Sub

This will intercept the error number 68 (Drive not prepared) and display a message.

If you want to put a default drive to a drive listbox, use the Drive property:

drive1.drive="f:"       'Put the F: as default
0
 

Author Comment

by:WCOLEMAN01
ID: 2882092
Answer accepted
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…

863 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

22 Experts available now in Live!

Get 1:1 Help Now