SET Focus error

Kobus-Dippenaar

Registered User.
Local time
Tomorrow, 01:11
Joined
Oct 10, 2014
Messages
50
Good day to all,
The code I have used before within the program to set the focus is not working. It Goes to the next field.

I have put the code into the Private Sub section using the LEFT FOCUS attribute.
As I click into the next field, thus leaving the date field, the if statement below does come into play, BUT it does not reset the focus to the date field in the form.

Private Sub DBDatelbl_LostFocus()
wstart = DLookup("[Stdstart]", "StockDates", "[Stdid]= 1")
If Me.DBDate <= wstart Then MsgBox "Date must be greater that Start Date": Me.DBDatelbl.SetFocus
End Sub

Your precious insight and wisdom is much appreciated.

Blessings
 
Are you are setting focus to the label?
 
@Gas-Man,
Yes I do set it to the label.

Before update attribute works, but not the left-focus, as described above.

Regards,
 
Sorry, I am thoroughly confused? :-(

Leftfocus?

Also my labels in 2003 doe not even have SetFocus and in design mode a label has no events?

Do you have Option Explicit in your code?

I'd best leave this to the experts?
 

Users who are viewing this thread

Back
Top Bottom