KevinJohnston
Technical User
I'm trying to update my database from 32-bit to 64-bit. SendKeys doesn't work any more, and I'm trying to replace SendKeys code with 64-bit friendly code (I've got about 32 instances of the SendKeys statement). For several instances, I've been able just to use Control.SetFocus statements to replace SendKeys Tab statements.
My problem comes when I want to go to the next field (Title) based on the key the user enters in the first field. For example, I want to move to the next field whenever the user presses "m" or "M". I've tried this with KeyUp, KeyDown and KeyPress and it doesn't work.
Here's the code associated with the KeyUp event for the first field with remarks.
Note that Me.Title.SetFocus works if I don't have it within Select Case statement, but doesn't if I do.
--------------
Private Sub ISBN_KeyUp(KeyCode As Integer, Shift As Integer)
On Error GoTo Err_ISBN_KeyUp
'Me.Title.SetFocus 'works here if I type any key
Select Case KeyAscii
Case 77, 109 'Capital or lower case "m"
'SendKeys "{Tab}" 'Works in 32-bit only
Me.Title.SetFocus 'Doesn't work here
Exit Sub
'Case Next, etc.
End Select
Exit_ISBN_KeyUp:
Exit Sub
Err_ISBN_KeyUp:
MsgBox Error$
Resume Exit_ISBN_KeyUp
End Sub
Hope the above is clear and someone can give me some guidance.
Thanks very much.
My problem comes when I want to go to the next field (Title) based on the key the user enters in the first field. For example, I want to move to the next field whenever the user presses "m" or "M". I've tried this with KeyUp, KeyDown and KeyPress and it doesn't work.
Here's the code associated with the KeyUp event for the first field with remarks.
Note that Me.Title.SetFocus works if I don't have it within Select Case statement, but doesn't if I do.
--------------
Private Sub ISBN_KeyUp(KeyCode As Integer, Shift As Integer)
On Error GoTo Err_ISBN_KeyUp
'Me.Title.SetFocus 'works here if I type any key
Select Case KeyAscii
Case 77, 109 'Capital or lower case "m"
'SendKeys "{Tab}" 'Works in 32-bit only
Me.Title.SetFocus 'Doesn't work here
Exit Sub
'Case Next, etc.
End Select
Exit_ISBN_KeyUp:
Exit Sub
Err_ISBN_KeyUp:
MsgBox Error$
Resume Exit_ISBN_KeyUp
End Sub
Hope the above is clear and someone can give me some guidance.
Thanks very much.