Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check if dir exists the create dir using field from form

Status
Not open for further replies.

Zepher2

Technical User
Dec 29, 2001
25
US
I have very limited knowledge of vba. I amtrying to check and see if a sub-folder exists on my c drive and if it does not then create one using the variable name FileNo.

The first time I run the procedure it creates the file as it should. However, if I click the button again I get this error message. run time error 75 "path\file access error.

Her is the code I am using. What am I doing wrong?

Thanks in advance

Private Sub CmdMakeDir_Click()

Dim test As Integer

test = Len(Dir("C:\Client Data" & "\" & Me.[FileNo]))
If test = 0 Then
'' directory doesn't exist

MkDir "C:\Client Data" & "\" & Me.[FileNo]

End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top