Hi, im building myself a error handler and part of it is to record the error details in a logging table. I have a function that flags up error number, description and location in a message box. How do i take these strings and long ints and record them into a table. Below is a snippet of code ive been trying, the problem is in my sql statement, any help appreciated!
ErrorLog = True
strMsg = strMsg & "There has been an error in the application." & vbCrLf & vbCrLf ''vbCRLF (Visual Basic Carriage Return Line Feed) is the VB shortcut for Chr(13) & Chr(10), ;
strMsg = strMsg & "Error Number: " & lngErrNum & vbCrLf
strMsg = strMsg & "Error Description: " & strErrDesc & vbCrLf
strMsg = strMsg & "Error Location: " & strWhereFrom & vbCrLf
strMsg = strMsg & "This error has been inputted into the error handling log table" & vbCrLf & vbCrLf
strMsg = strMsg & "Any further problems contact on.your.own@xxx.gov"
MsgBox strMsg, vbInformation, "Error Log."
sql = "INSERT INTO Error_handling_table (Error_Number,Error_Description,Error_Location ) VALUES (lngErrNumber,strErrDesc,strWhereFrom) "
DoCmd.RunSQL (sql)
ErrorLog = True
strMsg = strMsg & "There has been an error in the application." & vbCrLf & vbCrLf ''vbCRLF (Visual Basic Carriage Return Line Feed) is the VB shortcut for Chr(13) & Chr(10), ;
strMsg = strMsg & "Error Number: " & lngErrNum & vbCrLf
strMsg = strMsg & "Error Description: " & strErrDesc & vbCrLf
strMsg = strMsg & "Error Location: " & strWhereFrom & vbCrLf
strMsg = strMsg & "This error has been inputted into the error handling log table" & vbCrLf & vbCrLf
strMsg = strMsg & "Any further problems contact on.your.own@xxx.gov"
MsgBox strMsg, vbInformation, "Error Log."
sql = "INSERT INTO Error_handling_table (Error_Number,Error_Description,Error_Location ) VALUES (lngErrNumber,strErrDesc,strWhereFrom) "
DoCmd.RunSQL (sql)