freenet_2k@hotmail.c
Registered User.
- Local time
- Yesterday, 21:46
- Joined
- Sep 26, 2008
- Messages
- 20
I've been tinkering with this problem for a few days now and I can't get it to work. The code I am having trouble with is below. In some sense it works, but not completely. I have a form control that is linked to a table column that is "required" so that if the user does not enter anything in the required field before trying to save the record, an error msg pops up. Well the code I have posted here does supress the system error, but it appears as if two error messages come up instead of one. If I hit refresh, my custom msg comes up, but only after another system runtime error msg. Both of the error messages basically say the same thing, it's just that they look different. The one that gets supressed by this code, says I cannot leave the field blank. That message has only an "OK" button. The other message says basically the same thing, but is a ruintime error msg that gives me "End, Debug and cancel" buttons. The msg that has the "OK" button is the one that gets suppressed and is replaced with my custom msg when I hit refresh. The msg with "Debug" and "End" buttons is the one that comes up no matter what I do. If I take this code out of the form, I get two error msg's, so it looks like it is supressing one, but not the runtime msg. Can anyone help me with this? I need to be able to get rid of that runtime error. I'm VERY new to access and I have a strict deadline where I have to have this finished today or I'm in big trouble. Thanks in advance for any and all replies. I do appreciate it.
Here is the code I have in the On Error event of the form. BTW...I'm using Access 2007.
Begin VBA ode:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
'If an error occurs because of missing data in a required field
'display custom error message
Const conErrRequiredData = 3314
If DataErr = conErrRequiredData Then
MsgBox ("Please enter Manufacturer Name")
Response = acDataErrContinue
Else
'Display a standard error message
Response = acDataErrDisplay
End If
End Sub
Here is the code I have in the On Error event of the form. BTW...I'm using Access 2007.
Begin VBA ode:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
'If an error occurs because of missing data in a required field
'display custom error message
Const conErrRequiredData = 3314
If DataErr = conErrRequiredData Then
MsgBox ("Please enter Manufacturer Name")
Response = acDataErrContinue
Else
'Display a standard error message
Response = acDataErrDisplay
End If
End Sub
Last edited: