R
Rob W
Greetings,
I added my error checking (see code below) on the Form "On Current" event as
I believe this code will run upon any action on screen being actioned.
Errors happen when users are adding incomplete/incorrect data then pressing
the next navigation button which adds a record if it is the last record.
Where is best to put my error validation?
Thanks Rob
Private Sub Form_Current()
On Error GoTo MyErr
ExtenuatingCount = DCount("[StudentID]", "tblStudentsResultsDelivery",
"[StudentId]= '" & [txtStudentId] & "' AND [ExtenuatingCircumstances] =
True")
If ExtenuatingCount > 0 Then
Me.lblExtenuating.Visible = True
Else
Me.lblExtenuating.Visible = False
End If
MyExit:
Exit Sub
MyErr:
MsgBox "Please check all information is correct and present",
vbExclamation
Me.txtStudentId.SetFocus
Resume MyExit
End Sub
I added my error checking (see code below) on the Form "On Current" event as
I believe this code will run upon any action on screen being actioned.
Errors happen when users are adding incomplete/incorrect data then pressing
the next navigation button which adds a record if it is the last record.
Where is best to put my error validation?
Thanks Rob
Private Sub Form_Current()
On Error GoTo MyErr
ExtenuatingCount = DCount("[StudentID]", "tblStudentsResultsDelivery",
"[StudentId]= '" & [txtStudentId] & "' AND [ExtenuatingCircumstances] =
True")
If ExtenuatingCount > 0 Then
Me.lblExtenuating.Visible = True
Else
Me.lblExtenuating.Visible = False
End If
MyExit:
Exit Sub
MyErr:
MsgBox "Please check all information is correct and present",
vbExclamation
Me.txtStudentId.SetFocus
Resume MyExit
End Sub