
Originally Posted by
ajetrumpet
I don't get that. Cursor keys? Scroll through the options? What does this stuff mean??
Sorry, perhaps that was too British and too elliptical.
Cursor keys = arrow keys
Scroll through the options = move the focus from the first option to the second, then the third, then the fourth, then back to the first, and so on
Perhaps this would have been clearer: 'What I'm trying to achieve here is to make the arrow keys move the focus to the next control rather than to the next option button in the option group.'
Of course there is, change the keycode to TAB, which is 9. so in your code, if you want to move to the next enabled field if the user presses Right arrow or tab, maybe write:
Code:
Private Sub OptionButton_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 27 or KeyCode = 9 Then
KeyCode = 9
else
MsgBox "You can't do that."
end if
End Sub
Thanks, I'll give that a try.
what does
docmd.cancelEvent do? Never used it.
I think (it's several months since I wrote that code) it cancels the normal behaviour of the arrow key. So if I have just ...
Code:
If KeyCode = vbKeyRight Then
SendKeys "{TAB}"
End If
... I get the normal arrow key behaviour plus the tab key behaviour. But if I have ...
Code:
If KeyCode = vbKeyRight Then
SendKeys "{TAB}"
DoCmd.CancelEvent
End If
... I get just the tab key behaviour. I hope this isn't Martian.