I have a field on my form called txtEnterFile. I want the user to enter the filename they wish to import to excel here. This works with the code below, however, it will only accept a file name from one area on my computer, namely, My Documents. It will not recognize a file from any other folders in my Documents. This database will be stored on a shared drive, so I need the function to work for any file on the drive. Any suggestions?
Private Sub CmdImportTable_Click()
Dim txtEnterFile As String
txtPrompt = txtFileName
DoCmd.TransferSpreadsheet transfertype:=acImport, _
tablename:=txtEnterFile, _
FileName:=txtEnterFile, Hasfieldnames:=True, _
Range:="Sheet1!B2:B5"
End Sub