Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

unavailable device

Posted on 2000-04-20
3
Medium Priority
?
235 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 9

Accepted Solution

by:
Dalin earned 280 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

610 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