Error 53: File Not Found

G

Guest

I am trying to export records to a txt file. I got the errot "Error 53: File
Not Found" between these lines
DoCmd.TransferText acExportDelim, , DocName, STRINGFOLDER & STRINGFILE &
TEXTEXT, True, ""
Kill STRINGFOLDER & STRINGFILE & STREXT

I am using MS 2000 and Windows XP, the values for DocName like "Export_Win"
are queries. Filter_Wins is a routine to filter the query but right now the
filter is empty. I am using a valid filename and file location. The queries
are pre-built and I can open them up and look them, they seem fine.

Dim DocName As String
Dim STRINGFOLDER As String
Dim STRINGFILE As String
Const TEXTEXT As String = ".txt"
Const STREXT As String = ".str"

STRINGFOLDER = File_Location.Value
STRINGFILE = File_Name.Value

If (FrameTableToExport.Value = 1) Then
DocName = "Export_Win"
Filter_Wins
ElseIf (FrameTableToExport.Value = 2) Then
DocName = "Export_Secondary_Wins"
Filter_Wins
ElseIf (FrameTableToExport.Value = 3) Then
DocName = "Export_Investigators"
Filter_Wins
End If

If (IsNull(FrameTableToExport.Value) = False) And (File_Name.Value <> "")
And (IsNull(File_Name.Value) = False) And (File_Location.Value <> "") And
(IsNull(File_Location.Value) = False) Then
DoCmd.TransferText acExportDelim, , DocName, STRINGFOLDER & STRINGFILE &
TEXTEXT, True, ""
Kill STRINGFOLDER & STRINGFILE & STREXT
Name STRINGFOLDER & STRINGFILE & TEXTEXT As STRINGFOLDER & STRINGFILE &
STREXT
MsgBox "Transfer to " & STRINGFOLDER & STRINGFILE & STREXT & " is
complete.", vbInformation, "Winners File"
ElseIf (IsNull(FrameTableToExport.Value) = True) Then
MsgBox "Please enter a table name for the export.", , "Missing Table Name"
ElseIf (File_Name.Value = "") Or (IsNull(File_Name.Value) = True) Then
MsgBox "Please enter a filename for the export.", , "Missing Filename"
ElseIf (File_Location.Value = "") Or (IsNull(File_Location.Value) = True) Then
MsgBox "Please enter a file location for the export.", , "Missing File
Location"
End If
 
D

Douglas J. Steele

Perhaps the file doesn't actually exist.

Try:

If Len(Dir(STRINGFOLDER & STRINGFILE & STREXT)) > 0 Then
Kill STRINGFOLDER & STRINGFILE & STREXT
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top