Checking for Directory

harrisw

Registered User.
Local time
Today, 17:00
Joined
Mar 27, 2001
Messages
131
have the code below checking if a directory exists:

JobRef = Left(Form_frmViewJob.txtJobReference, 8) & " - " & Right(Form_frmViewJob.txtJobReference, 6)

Me.dlgViewJobFolder.InitDir = "w:\dosapps\delta5\private\b2bdbase\borisdata\" & JobRef

If Dir(Me.dlgViewJobFolder.InitDir) = "" Then
MsgBox ("Directory not exist " & Me.dlgViewJobFolder.InitDir)
GoTo exit_sub
End If

Me.dlgViewJobFolder.showopen

For some reason it always drops into the "directory not exist message" even if the directory does exist.

Please help.
 
You are missing the vbDirectory option. Chech the help file for more options with the Dir function.

I am using Access 97 so I am not sure what your ".IntDir" is.

If Dir(Me.dlgViewJobFolder.InitDir, vbDirectory) = "" Then

To test your return, I suggest that you call the "Me.dlgViewJobFolder.InitDir" in a message box like
MsgBox Me.dlgViewJobFolder.InitDir

HTH
 
Great, works fine with the vbdirectory bit in
 

Users who are viewing this thread

Back
Top Bottom