B
BP
Hello,
I have a field(Date type set in table) in a form based on a query, when a
non-date entry is entered, it automatically prompts a popup warning to state
that it is not a valid entry.
After I add in some code in the Error event of the form (suggested by one of
the advisors here to prevent multi-user problems), the prompt does not pop up
when I enter a non-date entry into the date field and also does not save the
entry as well and the focus is still at the date field.
I require the popup warning though, can someone pls look at whats wrong with
the code below that it affects the normal operation of the field validation?
Private Sub Form_Error(DataErr As Integer, Response As Integer)
On Error GoTo Err_Form_Error
Response = IncrementField(DataErr)
Exit_Form_Error:
Exit Sub
Err_Form_Error:
MsgBox Err.Description
Resume Exit_Form_Error
End Sub
Function IncrementField(DataErr)
If DataErr = 3022 Then
Me![Job No] = DMax("[Job No]", "[QT Job Record]") + 1
IncrementField = acDataErrContinue
End If
End Function
Thanks
I have a field(Date type set in table) in a form based on a query, when a
non-date entry is entered, it automatically prompts a popup warning to state
that it is not a valid entry.
After I add in some code in the Error event of the form (suggested by one of
the advisors here to prevent multi-user problems), the prompt does not pop up
when I enter a non-date entry into the date field and also does not save the
entry as well and the focus is still at the date field.
I require the popup warning though, can someone pls look at whats wrong with
the code below that it affects the normal operation of the field validation?
Private Sub Form_Error(DataErr As Integer, Response As Integer)
On Error GoTo Err_Form_Error
Response = IncrementField(DataErr)
Exit_Form_Error:
Exit Sub
Err_Form_Error:
MsgBox Err.Description
Resume Exit_Form_Error
End Sub
Function IncrementField(DataErr)
If DataErr = 3022 Then
Me![Job No] = DMax("[Job No]", "[QT Job Record]") + 1
IncrementField = acDataErrContinue
End If
End Function
Thanks