Checking for Directory (1 Viewer)

harrisw

Registered User.
Local time
Today, 00:44
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.
 

ghudson

Registered User.
Local time
Yesterday, 19:44
Joined
Jun 8, 2002
Messages
6,195
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
 

harrisw

Registered User.
Local time
Today, 00:44
Joined
Mar 27, 2001
Messages
131
Great, works fine with the vbdirectory bit in
 

Users who are viewing this thread

Top Bottom