H
Heidi
I have a subform in which data entry persons can edit
previously entered data. In the OnClose Property of this
subform, I want do make some data validations. For
example, if the data entry person made ReportType = P and
didn't fill a weight in the "Wt" field, a message box
would pop up asking them to fill in a weight for a
positive report. Then I want the subform to not close,
but set the focus on the field "Wt." This is the code I
used:
If Me.RptType = "P" And IsNull(Me.Wt) Then
MsgBox "You must enter weight.", vbOKOnly
Cancel = True
Me.Wt.SetFocus
End If
However, when the user hits the "OK" button, the subform
closes anyway and pops the user back to the main form.
What am I doing wrong???
previously entered data. In the OnClose Property of this
subform, I want do make some data validations. For
example, if the data entry person made ReportType = P and
didn't fill a weight in the "Wt" field, a message box
would pop up asking them to fill in a weight for a
positive report. Then I want the subform to not close,
but set the focus on the field "Wt." This is the code I
used:
If Me.RptType = "P" And IsNull(Me.Wt) Then
MsgBox "You must enter weight.", vbOKOnly
Cancel = True
Me.Wt.SetFocus
End If
However, when the user hits the "OK" button, the subform
closes anyway and pops the user back to the main form.
What am I doing wrong???