Storyteller
Instructor
Hello All,
I have incorporated the following error handling from the Help files into a form:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Dim Msg
' If an error occurs, construct an error message
On Error Resume Next ' Defer error handling.
' Check for error, then show message.
If Err.Number >= 0 Then
Msg = "Error # " & Str(Err.Number) & " was generated by " _
& Err.Source & Chr(13) & Chr(10) & Err.Description
MsgBox Msg, , "Error", Err.HelpFile, Err.HelpContext
End If
End Sub
The reason is that I have been getting a persistant error message: "The Value you entered isn't valid for this field." The weird thing is that this error message only shows up some of the time. Mostly when scrolling through the records and not after entering data into fields.
After adding the error handling I get the following message box: "Error # 0 was generated by" now the part that is missing is what field is actually causing the error. Ideally, what I would like to be able to do is to SetFocus on the field causing the error.
Any suggestions on how I could tweak the code to show which field(s) is causing the problem.
Thanks for your advice.
Regards,
Michael
I have incorporated the following error handling from the Help files into a form:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Dim Msg
' If an error occurs, construct an error message
On Error Resume Next ' Defer error handling.
' Check for error, then show message.
If Err.Number >= 0 Then
Msg = "Error # " & Str(Err.Number) & " was generated by " _
& Err.Source & Chr(13) & Chr(10) & Err.Description
MsgBox Msg, , "Error", Err.HelpFile, Err.HelpContext
End If
End Sub
The reason is that I have been getting a persistant error message: "The Value you entered isn't valid for this field." The weird thing is that this error message only shows up some of the time. Mostly when scrolling through the records and not after entering data into fields.
After adding the error handling I get the following message box: "Error # 0 was generated by" now the part that is missing is what field is actually causing the error. Ideally, what I would like to be able to do is to SetFocus on the field causing the error.
Any suggestions on how I could tweak the code to show which field(s) is causing the problem.
Thanks for your advice.
Regards,
Michael