Tab Key/Enter Key Options

Krysti

Registered User.
Local time
Yesterday, 19:38
Joined
Sep 20, 2002
Messages
40
Does anyone know if there is a way to get the Tab key to move to the next record instead of the next field for a specific form?

If not, is there a way to get the Enter key to move to the next record for a "specific" form? I don't want to use the Tools, Options, Keyboard because then it changes it for all the forms.

Thank you :)

Krysti
 
I've never set it up myself but look up the 'On Key Press' event in the help section. I think you can set something up that will do what you're looking for.
 
Thanks for the reply. I did what you suggested and read info on the On Key Press event. I found out the ANSI for the Tab key is 9 so I tried the following code on the On Key Press event:

Private Sub SystemID_KeyPress(KeyAscii As Integer)
If KeyAscii = 9 Then
DoCmd.GoToRecord acForm, "tblSamples", acNext
End If
End Sub

Admittedly, I am no expert on code, which is a big time understatement. Big surprise, it didn't work.

Any suggestions on how to write the code to get it to work?

:o Doh!

Krysti
 
Well don't be too hard on yourself. That looks like how I would've wrote it. What kind of error message are you getting?
 
It's pretty normal (for even novice users) to naturally use the tab or enter key to move to the next field.

Why would you want to remove this 'natural feature' and how will users get from field to field if you do?

The left and right arrow keys might be a better choice for you.
 
Rob,

Weird. It works when I use 65 for the ANSI instead of 9. 65 is the letter A. So when I put an A in the field, it moves to the next record, but it won't recognize 9 as the tab key.

Got any suggestions?

I'll keep trying :eek:

Krysti
 
Kevin,

That's why I want to change it only for one form. The users want to be able to enter a number of records at one time, a field at a time for a specific form. So I don't want to use the Tools, Options, Keyboard because that will change how the Enter key reacts for every form.

Got any suggestions?

Thanks,

Krysti
 
lol! Not the first time I've been surprised by Access. I guess if you got it working go with it.

I do think that Kevin has a point. Do you want to think about using a different key to accomplish this?
 
Access has built in keys to do this...

CTRL & PgDown will take you to the same field in the next record.

CTRL & PgUP will take you to the same field in the Prev. record

Just put a label on the form to let the users know.

'Why re-invent the wheel' :)
 
Just had another idea (sorry Rob!)

Why not remove the tab stops from the other fields.

You could even toggle the tab stops on/off using a tick box via code.

Rob'll tell you how to do that bit :)
 
Aha! That will work!

Thanks you guys :D

Krysti
 
Kevin, Kevin Kevin...

If you're going to start assigning work to me I'm going to have to charge you a consultant fee. :D
 
Anudder question, thought I'd throw it out there for you both to fight over :)

Before I waste hours and hours trying to come up with the code to do this, I'd see if you guys know off hand.

I changed the form to turn off the tab stops. Now, any field I'm in, when I tab, it tabs down to the next record, but back to the first field... Argh!

Do you know off hand, what code I could use to make stay in the same field?

Krysti :cool:
 
Rob.Mills said:
I think Kevin will tell you how to do that. :p

LOL, I asked for that !

Krysti

If you keep the tab stop ON for one field and OFF for the rest
(I assume this is what you want), then surely when you tab/enter whilsi it has the focus, it will go to the same field with the Tab Stop ON in the next record.

Just tried this on a form and it does just that.

Maybe Rob can shed some light :)
 
Uh oh Rob, I think it's your turn :D

I'm not sure I'm following. I have the form set up as tabular, continuous. This is how it looks:

FName LName Address
FName LName Address
FName LName Address

After I enter a FName, I want it to tab down to the next FName and so on. Once I've entered as many FName's as I want, I want to click in the LName and start entering those. Then the Addresses, etc.

Help :confused:

Krysti
 
Your orig post implies that you just want to remain on the same field throughout.

Your last post clears things up some waht.

I must say it's a very unorthodox way of entering records, but if that's what you want.....

Here's ANOTHER idea (i amaze myself sometimes :D )

I have a routine that lets you use all the arrow keys to navigate up, down, left & right through fields and across records on a cont subform, rather like a spreadsheet.

Try it out, think you might like it.

It's quite elegant ;)

I tend to use it in all my cont subforms....



(instructions on usage are in the code).....

Function ArrowKeysNavigate(intKeyCode As Integer)

'****** Arrow key navigation procedure for continous subforms *****

'Allows Up and down arrow keys to navigate through records, spreadsheet style

'Call from form's KeyDown event....
'ArrowKeysNavigate KeyCode

'NOTE Key preview (Event) on form MUST be set to Yes, No is set by default.

On Error GoTo Form_KeyDown_Err
Select Case intKeyCode
Case vbKeyDown
DoCmd.GoToRecord Record:=acNext
intKeyCode = 0
Case vbKeyUp
DoCmd.GoToRecord Record:=acPrevious
intKeyCode = 0
Case Else
' Do nothing at all!
End Select

Form_KeyDown_Exit:
Exit Function

Form_KeyDown_Err:
Select Case Err.Number
Case adhcErrInvalidRow
intKeyCode = 0
Case Else
MsgBox "Error: " & Err.Description & _
" (" & Err.Number & ")"
End Select
Resume Form_KeyDown_Exit
End Function
 
Last edited:
Couldn't have put it more elegantly! ;)

Wasn't able to check for a few hours just in case you were wondering what happened to me. :D
 

Users who are viewing this thread

Back
Top Bottom