paulmcneil
asked on
Return to invalid textbox after update
I have this code in the AfterUpdate event of a from textbox:
If Not IsNumeric(Me.txtTransactio nsProcesse d) Then
MsgBox Me.Controls("lbltxtTransac tionsProce ssed").Cap tion & " must be a number.", vbInformation, "Pricing Scorecard"
Me.txtTransactionsProcesse d = Null
End if
I'm simply validating that the user's entry is a number. After the message displays, the cursor moves to the next textbox in the form.
What I want is for the textbox I just validated () to keep the focus after the message is displayed. Thanks
If Not IsNumeric(Me.txtTransactio
MsgBox Me.Controls("lbltxtTransac
Me.txtTransactionsProcesse
End if
I'm simply validating that the user's entry is a number. After the message displays, the cursor moves to the next textbox in the form.
What I want is for the textbox I just validated () to keep the focus after the message is displayed. Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I would avoid using Sendkeys. It is problematic.
Try using the .Undo method of the control
Try using the .Undo method of the control
SendKeys "{ESC}" >>> Me.YourControlName,Undo
What MX said!
Me.YourControlName.Undo
Me.YourControlName.Undo
Sorry I did not see that post ...
ASKER
SendKeys "{ESC}"
to clear the field after the msg