Solved

unavailable device

Posted on 2000-04-20
3
216 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…

762 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

17 Experts available now in Live!

Get 1:1 Help Now