Solved DriveExist error

The Rev

Registered User.
Local time
Today, 15:44
Joined
Jan 15, 2003
Messages
119
Trying to see if a drive is mapped before I run some code on that drive path from my database. It may be empty so fileExists or FolderExists won't help. It's supposed to work simply, but I'm getting the" Object doesn't support this". Banging my head against the wall....

Code:
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.DriveExists ("R:\") Then
     Msgbox "R Drive mapped", vbOkOnly
End If

Why isn't it working?
 
What happens - error message, wrong result, nothing?

The method works for me. If you want to provide a message for both results:

MsgBox "R Drive " & IIf(objFso.DriveExists("R:\"), "Mapped", "Not Mapped"), vbOKOnly
 
It works for me too. Which line is highlighted when you debug?
 
the DriveExists line is highlighted with the "Object doesn't support this property or method" error. I have Access on another PC and I put this code into a blank DB and it worked there. Just not on my laptop.
 
So somehow, a non-ASCII character got in my string for the drive letter. I deleted the line and retyped it and it now works. That was just strange...
 
So somehow, a non-ASCII character got in my string for the drive letter. I deleted the line and retyped it and it now works. That was just strange...
Glad to hear you got it sorted out. Cheers!
 
I wouldn't have thought you would have spaces in there either?
 

Users who are viewing this thread

Back
Top Bottom