If, Then, Else...

chuckgoss

Registered User.
Local time
Today, 12:57
Joined
Mar 26, 2001
Messages
44
Hi everybody,
Hope sombody can help here. I've been very frustrated in trying to get a text box called Test to work to keep a user from returning more parts to the inventory (on the form) than he/she really has (finger checks when entering in the amount they are returning). The code is as follows:

Private Sub Test_AfterUpdate()

If [QuantityYouHave] - [Test] < 0 Then
MsgBox "You can't return more parts than you have"
Test.Value = ""
Test.SetFocus

End If

End Sub

The idea is that after the error, the control called Test will be reset back to empty (that part works), and the focus will be set back onto it so that the user can try again to enter the correct value. Instead of setting the focus back onto the control called Test, the focus goes to the next control in the tab order on the form. Very Frustrating! Any help out there?

Thanks in advance,

chuck
 
Why not use the BeforeUpdate event instead? This way your field will not be updated and the focus should remain where it is(on your 'Test' field).
 

Users who are viewing this thread

Back
Top Bottom