Enter Key and Tab Key Behavior

Shannon42169

New member
Local time
Today, 11:25
Joined
Apr 26, 2011
Messages
2
Can someone tell me how I can make it to where when the user hits the tab key, it will tab through the fields on a table or form and when the user hits the Enter key, it will open a new record in the first field?


Most of the records that will be entered into my database will not have all fields filled out so the user will generally not reach the last field. So, that means every time he/she wants to open a new record, it requires a mouse operation.

I know how to set the "Move After Enter" to "Next Record" but that just gets the user to a new record in the same field. I want it to open a new record in the first field so the user does not have to remove his/her hands from the keyboard to open a new record.

Is there any way to do this?

Thanks.
 
Welcome to the Forum,

Have you considered using a Form and then look at the Events behind the Field, so you could use an On Exit Event to add new record.
 
Hello! And thank you for your reply. I have not tried the On Exit event to add a new record because there's no one field that will always be the last field with data entered into it. If I applied the On Exit event to every field, that wouldn't work either, for obvious reasons. It just seems like there should be any easy way to use the keyboard to open a new record at the first field. But, I'm having the hardest time figuring out how to do that. If you have any other suggestions, I'd be happy to try!
 
You could use something like this in the forms KeyDown event.

Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
    DoCmd.GotoRecord , , acNewRec
    Me.[B]NameOfFirstControl[/B].SetFocus
End If
End Sub

Change the name marked in bold to the name of the first control in your Taborder for the form.

JR
 

Users who are viewing this thread

Back
Top Bottom