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
Douglas J. Steele - 27 Jun 2007 14:37 GMT
If you can't use a mapped drive letter, then try a UNC
(\\server\share\folder\file)
Alternatively, you can use the code from
http://www.mvps.org/access/api/api0003.htm at "The Access Web" to determine
which drive letter is mapped to the share.

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
>I am running the following code to import all text files that all start
>with
[quoted text clipped - 40 lines]
> Thanks
> Database girl
Database girl - 27 Jun 2007 15:38 GMT
Doug,
I had forgotten to put in the share name when I referenced the strpath in my
code. Silly me!
Thanks for your help.
> If you can't use a mapped drive letter, then try a UNC
> (\\server\share\folder\file)
[quoted text clipped - 47 lines]
> > Thanks
> > Database girl
Eric Blitzer - 27 Jun 2007 15:14 GMT
A different approach would be to use a drive letter you know is available on
every machine like P: using the shell command
Shell "net use P: \\server\foldername"
then you could reference the drive letter.
I sure this is not as good as Doug's answer.
> I am running the following code to import all text files that all start with
> the same 12 characters:
[quoted text clipped - 38 lines]
> Thanks
> Database girl