Right and Left Arrow Keys

  • Thread starter User via AccessMonster.com
  • Start date
U

User via AccessMonster.com

I have a form with two command buttons:

cmdNextRecord
cmdPreviousRecord

Is there coding out there that will allow the user to control the command
button "cmdNextRecord" On Click Event with the keyboard's right arrow key?...
And the command button "cmdPreviousRecord" with the left arrow key?

Any help would be great!!!!
 
D

Daryl S

Not sure how to code for the right/left arrow keys, but you users can use the
PageUp and PageDown keys to scroll among the records.
 
L

Linq Adams via AccessMonster.com

For the form, goto Properties - Events and set Key Preview to Yes.

Then use this code:

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyRight Then Call cmdNextRecord_Click
If KeyCode = vbKeyLeft Then Call cmdPreviousRecord_Click
End Sub

But I have to warn you, most users are going to expect the Left/Right arrows
to move the cursor to the left or right and might not like to find out that
standard functions have been removed!
 
U

User via AccessMonster.com

Events and set Key Preview to Yes.
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyRight Then Call cmdNextRecord_Click
If KeyCode = vbKeyLeft Then Call cmdPreviousRecord_Click
End Sub

Works Great!!!

Thank You!!!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top