xaviermobius
Registered User.
- Local time
- Today, 23:44
- Joined
- Jul 25, 2006
- Messages
- 12
Hi all,
I have an unbound text box called idfind and the value entered is an id which is to be loaded on pressing enter.
The problem is - when the user presses the enter key after typing the id the focus shifts to another control and the keypress action doesnt get run.
My question is how do i either: a) diable the use of tab/enter focus shifting for this textbox only or b) work around?
I have a workaround using a button on click action - but its quite important that the user is able to load a record id by typing it in the pressing enter. (can be done with one hand using numpad keys).
Here is the code i have so far....
Private Sub idfind_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Dim rs As Object
Set rs = Me.RecordsetClone
rs.FindFirst "ID= " & Me.idfind
If rs.NoMatch = False Then
Me.Bookmark = rs.Bookmark
Else
MsgBox "ID not found"
End If
rs.Close
Set rs = Nothing
End Sub
As you can see the action is on keypress and is detecting for the enter key press (ascii code 13). But when enter is pressed focus is moved from the field to a new control before the THEN statement can be run...
help appreciated please!
I have an unbound text box called idfind and the value entered is an id which is to be loaded on pressing enter.
The problem is - when the user presses the enter key after typing the id the focus shifts to another control and the keypress action doesnt get run.
My question is how do i either: a) diable the use of tab/enter focus shifting for this textbox only or b) work around?
I have a workaround using a button on click action - but its quite important that the user is able to load a record id by typing it in the pressing enter. (can be done with one hand using numpad keys).
Here is the code i have so far....
Private Sub idfind_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Dim rs As Object
Set rs = Me.RecordsetClone
rs.FindFirst "ID= " & Me.idfind
If rs.NoMatch = False Then
Me.Bookmark = rs.Bookmark
Else
MsgBox "ID not found"
End If
rs.Close
Set rs = Nothing
End Sub
As you can see the action is on keypress and is detecting for the enter key press (ascii code 13). But when enter is pressed focus is moved from the field to a new control before the THEN statement can be run...
help appreciated please!