R
Richard Hollenbeck
I can't see anything wrong with the following StrSQL string but I get this
error:
Run-time error "3134':
Syntax error in INSERT INTO statement.
Here's the code:
Public Function myErrorHandler(Num As Long, descr As String, src As String)
As VbMsgBoxResult
Dim StrSQL As String
myErrorHandler = MsgBox("Error number: " & Num & vbCrLf & descr & vbCrLf
& "Source: " & src)
'report the error to the error log table
StrSQL = "INSERT INTO tblErrorLog (Number, Description, Source) VALUES
( " & Num & ", '" & descr & "', " & src & " )"
CurrentDb.Execute StrSQL, dbFailOnError
End Function
The debugger seems to be reading the Err.Number, Err.Description, and
Err.Source correctly, and I have carefully checked that the field names in
tblErrorLog are spelled correctly and are in the correct order. I'm calling
this function from within an error handler by saying:
Err_Form_Load:
Dim x
x = myErrorHandler(Err.Number, Err.Description, Err.Source)
Resume Err_Form_Load_Exit
End Sub
It correctly returns the msgBox with the error report inside it but hangs on
the syntax error in the query string.
error:
Run-time error "3134':
Syntax error in INSERT INTO statement.
Here's the code:
Public Function myErrorHandler(Num As Long, descr As String, src As String)
As VbMsgBoxResult
Dim StrSQL As String
myErrorHandler = MsgBox("Error number: " & Num & vbCrLf & descr & vbCrLf
& "Source: " & src)
'report the error to the error log table
StrSQL = "INSERT INTO tblErrorLog (Number, Description, Source) VALUES
( " & Num & ", '" & descr & "', " & src & " )"
CurrentDb.Execute StrSQL, dbFailOnError
End Function
The debugger seems to be reading the Err.Number, Err.Description, and
Err.Source correctly, and I have carefully checked that the field names in
tblErrorLog are spelled correctly and are in the correct order. I'm calling
this function from within an error handler by saying:
Err_Form_Load:
Dim x
x = myErrorHandler(Err.Number, Err.Description, Err.Source)
Resume Err_Form_Load_Exit
End Sub
It correctly returns the msgBox with the error report inside it but hangs on
the syntax error in the query string.