"Setfocus" not working

ThunderBolt

Registered User.
Local time
Today, 18:32
Joined
Apr 29, 2003
Messages
25
Private Sub Quantity_AfterUpdate()
If [Quantity] < 1 Or [Quantity] > 3 Then
MsgBox "Invalid Number Of Labourers", vbOKOnly
[Quantity] = Null
[Quantity].SetFocus
End If
End Sub

The SetFocus command doesn't seem to work. I want the cursor to be set in the "Quantity" test box, but it isn't working???

Any help would be much appreciated.

Regards,
Thunderbolt
 
Try renaming your textbox to txtQuantity and fix the code around it.

Does that do anything?
 
Code:
Private Sub Quantity_AfterUpdate()
If [Quantity] < 1 Or [Quantity] > 3 Then
MsgBox "Invalid Number Of Labourers", vbOKOnly
Me.Quantity = ""
Me.Quantity.SetFocus
End If
End Sub

Thats should work :D

And i noticed this part of the code...

Code:
If [Quantity] < 1 Or [Quantity] > 3 Then

I'm not sure what you want but that says that you can have either ..."-2","-1","0","2","4","5","6"...

Is that how you want it? (Just wondering)
________
SUZUKI RV90
 
Last edited:

Users who are viewing this thread

Back
Top Bottom