T
thefonz37
Here's a big of code I have written so far:
Private Sub Form_Close()
Dim rsOutExceptions As Recordset
Set rsOutExceptions = CurrentDb().OpenRecordset("SELECT * FROM
tbl_Exceptions WHERE change_flag = TRUE;")
If rsOutExceptions.RecordCount > 0 Then
outFile = "M:\FTPTransfer\FE_Schedule_Exceptions\" & fOSUserName() &
"_" & Format(Now(), "yyyymmddhhhnnss") & ".txt"
' Open outFile For Output As #1
' Close #1
DoCmd.TransferText acExportDelim, "Modified_Exceptions_Export",
"qry_Modified_Exceptions", outFile
DoCmd.SetWarnings False
DoCmd.RunSQL ("UPDATE tbl_Exceptions SET change_flag = False;")
DoCmd.SetWarnings True
End If
rsOutExceptions.Close
End Sub
The idea is that when this form closes, it writes all the changed records to
a text file (which is named on the user's lan ID and the current date/time).
However, when this code executes, it returns the message: "Run-Time error
'3011': The Microsoft Office Access database engine could not find the object
<filename>. Make sure the object exists and that you spell its name and the
path name correctly."
As you can see, I even tried to add two lines of code (commented out above)
that manually create the text file, but even this doesn't work and it returns
the same error message that it can't find the file.
Private Sub Form_Close()
Dim rsOutExceptions As Recordset
Set rsOutExceptions = CurrentDb().OpenRecordset("SELECT * FROM
tbl_Exceptions WHERE change_flag = TRUE;")
If rsOutExceptions.RecordCount > 0 Then
outFile = "M:\FTPTransfer\FE_Schedule_Exceptions\" & fOSUserName() &
"_" & Format(Now(), "yyyymmddhhhnnss") & ".txt"
' Open outFile For Output As #1
' Close #1
DoCmd.TransferText acExportDelim, "Modified_Exceptions_Export",
"qry_Modified_Exceptions", outFile
DoCmd.SetWarnings False
DoCmd.RunSQL ("UPDATE tbl_Exceptions SET change_flag = False;")
DoCmd.SetWarnings True
End If
rsOutExceptions.Close
End Sub
The idea is that when this form closes, it writes all the changed records to
a text file (which is named on the user's lan ID and the current date/time).
However, when this code executes, it returns the message: "Run-Time error
'3011': The Microsoft Office Access database engine could not find the object
<filename>. Make sure the object exists and that you spell its name and the
path name correctly."
As you can see, I even tried to add two lines of code (commented out above)
that manually create the text file, but even this doesn't work and it returns
the same error message that it can't find the file.