iamareplicant
Programmer
Experts,
I need to use the keydown event in a text box to determine if the user has hit the enter key or the tab key.
If they have, I proceed to another routine to process the contents of that text box.
Problem: if I enter a value, say, "tr" into the textbox (key in "t", key in "r") then hit tab, I get to my keydown event's msgbox code (see below code), but in that event's routine, if I try to read the textbox's value, I get null (this is when i first open the form).
If I then type into the textbox, say, "CAT", then hit the tab key, the textbox's value is "tr" (see code below). In other words, the textbox's value is always the LAST value it had, not the current.
My simple test :
with a form with just one text box and the keydown event.
Sure enough, if I enter a value in the textbox and hit tab, the textbox (see msgbox in code above)does NOT have as its value the current value I just typed.
What can I do programmtically to type a value into a textbox, hit tab, and then have the textbox's value be what I entered? How can I "refresh" the textbox after a tab keystroke so that the current value in the text box IS the current value in the text box?
What am i missing? My head is bruised from the continued banging into desk...(help please)
TIA,
JBG
I need to use the keydown event in a text box to determine if the user has hit the enter key or the tab key.
If they have, I proceed to another routine to process the contents of that text box.
Problem: if I enter a value, say, "tr" into the textbox (key in "t", key in "r") then hit tab, I get to my keydown event's msgbox code (see below code), but in that event's routine, if I try to read the textbox's value, I get null (this is when i first open the form).
If I then type into the textbox, say, "CAT", then hit the tab key, the textbox's value is "tr" (see code below). In other words, the textbox's value is always the LAST value it had, not the current.
My simple test :
Code:
Private Sub txtQuantity_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Or KeyCode = 9 Then
MsgBox Me.txtQuantity
End If
End Sub
with a form with just one text box and the keydown event.
Sure enough, if I enter a value in the textbox and hit tab, the textbox (see msgbox in code above)does NOT have as its value the current value I just typed.
What can I do programmtically to type a value into a textbox, hit tab, and then have the textbox's value be what I entered? How can I "refresh" the textbox after a tab keystroke so that the current value in the text box IS the current value in the text box?
What am i missing? My head is bruised from the continued banging into desk...(help please)
TIA,
JBG