Hey helpful people,
I'm trying to highlight the text in a textbox control if the user enters something incorrect. I put this code (and more) in the AfterUpdate event.
[pre]
With Me.txtCheckNum
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
[/pre]
When I step through the code, I can see that the text in the textbox is getting highlighted (just as I want). But as soon as the code hits End Sub, the the text is unhighlighted and the cursor ends up at the beginning of the text in the textbox. Can anyone clue me as to what I'm doing wrong that the text doesn't stay highlighted?
Thanks!
I'm trying to highlight the text in a textbox control if the user enters something incorrect. I put this code (and more) in the AfterUpdate event.
[pre]
With Me.txtCheckNum
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
[/pre]
When I step through the code, I can see that the text in the textbox is getting highlighted (just as I want). But as soon as the code hits End Sub, the the text is unhighlighted and the cursor ends up at the beginning of the text in the textbox. Can anyone clue me as to what I'm doing wrong that the text doesn't stay highlighted?
Thanks!