naqayya
asked on
KeyCode combination
I use the following code to run cmdGoToNext_Click when F10 is pressed:
-------------------------- ---------- ---------- -------
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF10 And cmdGoToNext.Visible = True Then
cmdGoToNext_Click
End If
End Sub
-------------------------- ---------- ---------- --------
What should the code be to use Ctrl & Right Arrow together instead of F10?
Thanks.
--------------------------
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF10 And cmdGoToNext.Visible = True Then
cmdGoToNext_Click
End If
End Sub
--------------------------
What should the code be to use Ctrl & Right Arrow together instead of F10?
Thanks.
more properly it is
If KeyCode = vbKeyRight And CBool(Shift And vbCtrlMask) Then
MsgBox "YES"
End If
If KeyCode = vbKeyRight And CBool(Shift And vbCtrlMask) Then
MsgBox "YES"
End If
ASKER
deighton:
Both your solutions don't seem to work. When I use the first solution I get an error message, and the second just does an ordinary move right (to next field).
My code is:
-------------------------- ---------- ---------- -------
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If (KeyCode = vbKeyLeft And CBool(Shift And vbCtrlMask)) And (cmdGoToNext.Visible = True) Then
cmdGoToNext_Click
End If
End Sub
Private Sub cmdGoToNext_Click()
Check_Allocations
If StopCodeExecution = True Then
StopCodeExecution = False
Exit Sub
Else
DoCmd.GoToRecord acDataForm, "frmDonations", acNext
End If
End Sub
__________________________ __________ __________ ________
Can you help? Thanks.
Both your solutions don't seem to work. When I use the first solution I get an error message, and the second just does an ordinary move right (to next field).
My code is:
--------------------------
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If (KeyCode = vbKeyLeft And CBool(Shift And vbCtrlMask)) And (cmdGoToNext.Visible = True) Then
cmdGoToNext_Click
End If
End Sub
Private Sub cmdGoToNext_Click()
Check_Allocations
If StopCodeExecution = True Then
StopCodeExecution = False
Exit Sub
Else
DoCmd.GoToRecord acDataForm, "frmDonations", acNext
End If
End Sub
__________________________
Can you help? Thanks.
sorry dude, I guess that the arrow key still carries out its function regardless. I don't know how to stop that behaviour.
Feel free to delete the question and repost it if you want
Feel free to delete the question and repost it if you want
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
deighton: Thanks for that.
Jim: It works! Thanks again. BTW, can use a boolean type for intCtrlDown?
Jim: It works! Thanks again. BTW, can use a boolean type for intCtrlDown?
<<BTW, can use a boolean type for intCtrlDown? >>
Not sure. I've never tried it that way. True/false in Access is an integer type (-1/0). I've generally stayed away from the boolean type and implicit logic checks because of past bugs.
Jim.
Not sure. I've never tried it that way. True/false in Access is an integer type (-1/0). I've generally stayed away from the boolean type and implicit logic checks because of past bugs.
Jim.
If (KeyCode = 39 and shift = 2) And cmdGoToNext.Visible = True Then
cmdGoToNext_Click
End If
End Sub