Here is my code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Len(Me.TherapyStartDate & "") = 0 Then
Cancel = True
MsgBox "You must enter a value in Date!"
Me!TherapyStartDate.SetFocus
ElseIf Len(Me.TherapyStartTime & "") = 0 Then
Cancel = True
MsgBox "You must enter a value in Start Time!"
Me!TherapyStartTime.SetFocus
ElseIf Len(Me.TherapyEndTime & "") = 0 Then
Cancel = True
MsgBox "You must enter a value in End Time!"
Me!TherapyEndTime.SetFocus
End If
End Sub
hth
"Mary" <mmcgil...@msn.com> wrote in message
news:1144709473....@z34g2000cwc.googlegroups.com...
Try setting the focus to the tab page first, then the field on that page?
--
regards,
Br@dley
On Error GoTo Err_Handle
DoCmd.RunCommand acCmdSaveRecord
DoCmd.Close , , acSaveNo
Err_Exit:
Exit Sub
Err_Handle:
Select Case err.Number
Case Not 2501
MsgBox err.Number & " " & err.Description, "Unknown error"
End Select
hth
"Mary" <mmcgil...@msn.com> wrote in message
news:1144717015....@v46g2000cwv.googlegroups.com...
I tried adding:
Me!Session.SetFocus
before the lines that set focus to the null fields. It closes anyway.
Thanks for your response.
I figured I was missing something!
That did the trick. Thank you so much for your help!
Mary
"Mary" <mmcgil...@msn.com> wrote in message
news:1144721463.1...@z34g2000cwc.googlegroups.com...
Would one put this in the OnExit event of the subform??
Thank you, Tom
hth
"tlyczko" <tly...@gmail.com> wrote in message
news:1145215932....@v46g2000cwv.googlegroups.com...