B
BlakeD
I have a code block that is effectively running some data validation
checks. I have them in the Form_BeforeUpdate event, and am running the
evalation from an outside module. Code looks like this:
Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo Error_Form_BeforeUpdate
'Proceed with Data Checks until Exit or Cancel = True
Cancel = modDataChecks.CheckData(Me.ADDRESS, 1, "Address")
If True = Cancel Then Exit Sub
End If
Cancel = modDataChecks.CheckData(Me.FIRST_NAME, 1, "First
Name")
If True = Cancel Then Exit Sub
End If
Cancel = modDataChecks.CheckData(Me.LAST_NAME, 1, "Last Name")
If True = Cancel Then Exit Sub
End If
Exit_Form_BeforeUpdate:
Exit Sub
Error_Form_BeforeUpdate:
MsgBox Err.Description
Resume Exit_Form_BeforeUpdate
End Sub
How can I make access evaluate the value of Cancel after each step and
exit the sub if/when Cancel = True?
I have tried Do While/Loop, While/Wend, but they all evaluate at the
close of the loop / wend. Is there anything that evaluates after each
step?
checks. I have them in the Form_BeforeUpdate event, and am running the
evalation from an outside module. Code looks like this:
Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo Error_Form_BeforeUpdate
'Proceed with Data Checks until Exit or Cancel = True
Cancel = modDataChecks.CheckData(Me.ADDRESS, 1, "Address")
If True = Cancel Then Exit Sub
End If
Cancel = modDataChecks.CheckData(Me.FIRST_NAME, 1, "First
Name")
If True = Cancel Then Exit Sub
End If
Cancel = modDataChecks.CheckData(Me.LAST_NAME, 1, "Last Name")
If True = Cancel Then Exit Sub
End If
Exit_Form_BeforeUpdate:
Exit Sub
Error_Form_BeforeUpdate:
MsgBox Err.Description
Resume Exit_Form_BeforeUpdate
End Sub
How can I make access evaluate the value of Cancel after each step and
exit the sub if/when Cancel = True?
I have tried Do While/Loop, While/Wend, but they all evaluate at the
close of the loop / wend. Is there anything that evaluates after each
step?