D
Database girl
I am running the following code to import all text files that all start with
the same 12 characters:
' Set the parameters to import the text file
If Right(Me!txtFilePath, 1) = "\" Then
strPath = \\mdb8\Global
Else
strPath = \\mdb8\Global& "\"
End If
strFileName = "GlobalImport*.txt"
If FileExists(strPath & strFileName) = False Then
msgbox "File " & strPath & strFileName & " Does not exist!",
vbCritical + vbOKOnly, "No File..."
GoTo ExitImport
Else
GetName = Dir(strPath & strFileName)
End If
'Does file name exist in directory
Public Function FileExists(FName As String) As Boolean
On Error GoTo Err_FileExists
FileExists = False
FileExists = (Dir(FName) <> "")
Exit_FileExists:
Exit Function
Err_FileExists:
Select Case Err.Number
Case 76
FileExists = False
Resume Exit_FileExists
Case Else
msgbox Err.Number & vbCrLf & Err.Description, , "FileExistError"
Resume Exit_FileExists
End Select
End Function
When I run the code it will not return any of the text files located in
"//mdb8/Global". However, if I add a drive letter it works. This is not
practical since I am referencing a network drive. Any ideas on how I can get
about this???
Thanks
Database girl
the same 12 characters:
' Set the parameters to import the text file
If Right(Me!txtFilePath, 1) = "\" Then
strPath = \\mdb8\Global
Else
strPath = \\mdb8\Global& "\"
End If
strFileName = "GlobalImport*.txt"
If FileExists(strPath & strFileName) = False Then
msgbox "File " & strPath & strFileName & " Does not exist!",
vbCritical + vbOKOnly, "No File..."
GoTo ExitImport
Else
GetName = Dir(strPath & strFileName)
End If
'Does file name exist in directory
Public Function FileExists(FName As String) As Boolean
On Error GoTo Err_FileExists
FileExists = False
FileExists = (Dir(FName) <> "")
Exit_FileExists:
Exit Function
Err_FileExists:
Select Case Err.Number
Case 76
FileExists = False
Resume Exit_FileExists
Case Else
msgbox Err.Number & vbCrLf & Err.Description, , "FileExistError"
Resume Exit_FileExists
End Select
End Function
When I run the code it will not return any of the text files located in
"//mdb8/Global". However, if I add a drive letter it works. This is not
practical since I am referencing a network drive. Any ideas on how I can get
about this???
Thanks
Database girl