Hi. I am using access 2010
I have a textbox whose name is -------------- fltrStocknum
I have a routine whose name is -------------- SetFilter
The user would type in a number in fltrStocknum and then hit the <enter> key.
When this happens, I would like to call the SetFilter routine. Also, the focus must remain on the fltrStockNum textbox.
I do not wish to pass the value of fltrStockNum as a parameter to SetFilter. Instead, the SetFilter routine should be able to read the fltrStockNum textbox directly.
I have tried following code, but it doesn't work because the SetFilter routine reads the value of fltrStockNum as "" at that moment.
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If Screen.ActiveControl.Name = "fltrStocknum" Then
If KeyCode = 13 Then SetFilter
What is the best way to call the SetFilter routine when the user has hit the <enter> key.