Assigning a different role to keys

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I enter data that is read to me into a subform with several textboxes. I
have the cycle property set so that the cursor cycles through all the
textboxes without moving on to the next record. We want it this way since we
use the 2nd time through to read the values back as a check cycle. I then
have to click buttons to move to the Next or Previous record. This clicking
really slows things down. All the data is keyed into the numeric keypad, so
I want to use the adjacent PageUp or PageDn buttons to move to the Next or
previous records. QUESTION: How can I reassign this role to these buttons?
Oh ya - ideally, these buttons should only have their roles changed when
this form is open.

I'm a bit new at this, so don't be afraid to spell things out!
thanks
 
In the code behind the form place this code:

Private Sub Form_Load()
Me.KeyPreview = True
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

Select Case KeyCode

Case vbKeyUp
DoCmd.GoToRecord , , acNext

Case vbKeyDown
DoCmd.GoToRecord , , acPrevious

End Select

End Sub

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 
Victoria,
Place a button on your subform, Name it cmdNextRecord, and give it a Caption of &N
(You can hide the button if you want)

Using the Button's OnClick event, code it to go to the Next Record.

Private Sub cmdNextRecord_Click()
DoCmd.GoToRecord , , acNext
End Sub

While editing/reviewing the subform record, whenever you want to go to the Next record,
just hit Alt+N. Because the button Caption is &N, Alt+N will "fire" the button's code.
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 

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

Back
Top