Full Version: Set Focus Don't work
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
Tim
Hi,
I have got this code for bank and date checking. But once the error message has been shown the SetFocus don't go to where it should go.

Private Sub txtService_LostFocus()
If IsNull(Me.txtService) Then
MsgBox "Please Type Service ", vbInformation
Me.txtService.SetFocus
Exit Sub
End If

If (Me.txtService) <= Now() Then
MsgBox "Too late to make a service", vbInformation
Me.txtService.SetFocus
Exit Sub

End If
End Sub

I was wondering if anyone can help me. Please.
Thanks
strive4peace
you should be using the BeforeUpdate event of the control to validate data ... if the data is not valid, set CANCEL to true
Tim
Got it . Not to worry. Thanks for reading anyway.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.