G
Guest
I set up the following code listed below. The form is set up as a
multi-record form (Default View = Continuous Forms). The test is successful
on existing records preventing the user from going forward. When a new
record is added, the user can beat the system by clicking on the next line
and then clicking the save icon on the tool bar. Can the system be set up in
such a way that if the user adds a new record and the test fails, that he is
prevented from saving the record or even going to the next line by clicking
the mouse. Could the toolbar be disabled, preventing the user from being
able to save when the test fails ? Is any other code required in the
BeforeUpdate procedure to prevent the user from going forward until the error
is addressed ?
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.HRnum) Then
Cancel = MsgBox("You must enter an HR number.", vbCritical, "Data
Validation Failure")
End
End Sub
multi-record form (Default View = Continuous Forms). The test is successful
on existing records preventing the user from going forward. When a new
record is added, the user can beat the system by clicking on the next line
and then clicking the save icon on the tool bar. Can the system be set up in
such a way that if the user adds a new record and the test fails, that he is
prevented from saving the record or even going to the next line by clicking
the mouse. Could the toolbar be disabled, preventing the user from being
able to save when the test fails ? Is any other code required in the
BeforeUpdate procedure to prevent the user from going forward until the error
is addressed ?
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.HRnum) Then
Cancel = MsgBox("You must enter an HR number.", vbCritical, "Data
Validation Failure")
End
End Sub