|
-
Jun 11th, 2010, 05:32 AM
#1
Thread Starter
Junior Member
[RESOLVED]Access, Check Dir Existence, Make Dir, CopyFile
Hello Im doing my project well with ur great help. I have a problem with checking if dir/file on Server exist. I use ODBC and my connectivy is working. I use code to check if DIR exist.
Code:
If Dir("\\Servername\Dirname\") <> "" Then
MsgBox "It Exists!"
Else
MsgBox "No Go!"
End If
It works for C:\ etc. Im really confused about that. Ofc i can see Dir's on server from explorer. Any ideas?
Last edited by vitoo; Jun 11th, 2010 at 06:14 AM.
-
Jun 11th, 2010, 05:51 AM
#2
Re: Access, Check Dir Existence, Make Dir, CopyFile
you must specify to return directories as well as files
vb Code:
If Dir("\\Servername\Dirname\", vbDirectory) <> "" Then
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Jun 11th, 2010, 05:56 AM
#3
Re: Access, Check Dir Existence, Make Dir, CopyFile
And if you don't know what it is you could try...
vb Code:
Private Sub CommandButton1_Click()
Dim sDir As String
sDir = "\\Servername\Dirname\"
If Len(Dir(sDir, vbDirectory)) Then
If (GetAttr(sDir) And vbDirectory) = vbDirectory Then
MsgBox sDir & " does exist and is a FOLDER"
Else
MsgBox sDir & " does exist and is a FILE"
End If
Else
MsgBox sDir & " does not exist as anything."
End If
End Sub
-
Jun 11th, 2010, 06:12 AM
#4
Thread Starter
Junior Member
Re: Access, Check Dir Existence, Make Dir, CopyFile
Guys great work! I wonder if it can check only a dir 
Edit
It Can
Guys like alwyas GREAT WORK!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|