Programming Enter Key Behavior (1 Viewer)

rapsr59

Registered User.
Local time
Today, 13:32
Joined
Dec 5, 2007
Messages
93
Access 2000

In Access the Enter Key can be programmed to either go to the next record or go to the next field depending on the global setting.

The setting, which can be changed, using Tools, Options, Keyboard Tab, and selecting “Move after enter” setting: - 1. Next Field or 2. Next record.

I have a form that has two sets of records. It is more convenient to use the “Next Field” option on one of the recordsets, and more convenient to use the “Next Record” option on the second recordset.

Programatically, how can I instruct Access to programmatically alternate between the Next Field Option and the Next Record Option without having to open the Tool > Options > Keyboard Tab and manually changing the setting?


Thank you in advance,



Richard (rapsr59)
 
Personally I would probably use the Cycle property of the form. You can set the option you described with SetOption.
 
Enter Key behavior

Thank you for your assistance.

The cycle property does in fact control TAB key behavior. However more precisely, what I am looking for is a way to control the ENTER key behavior. Thanks again!

Have a very “Merry Christmas”

Richard (Rapsr59)
 
Okay, I THINK I found it:

Application.SetOption("Move After Enter", 1) ' to set it to move to the next control

Application.SetOption("Move After Enter", 2) ' to set it to move to the next record
 
Must have missed this?

The SetOption is not all that easy to figure out when if you haven't used it programmatically. There's not a lot of documentation on what the syntax is for the various options. Also, the value is not all that easy sometimes to figure out. This one wasn't too bad, but it could be better documented in the help files.
 
Plus, they asked about the Enter Key Behavior, which is actually NOT the one they really wanted. They really wanted the Move After Enter property (as deduced by their response to your accurate first answer).
 
Thank you, it worked!

Dear Bob Larson

May I introduce myself. My name is Richard A. Perez, Sr.

I would like to thank you for your snippet of code regarding my Enter Key Behavior problem.

I copied your code into my program exactly as you posted it. When I compiled the code, it gave me an error: “Expected: =”. I began playing with it and eventually removed the opening and closing parenthesis and

WAH LA! It worked perfectly!

Thank you, thank you, and thanks again.

I’m sure you are a guru and I am sure I have seen your name in some of the MS ACCESS manuals I have studied since 1996.

Please accept my whole hearted thanks and may you and yours have a very very Merry Christmas.


Sincerely, rapsr59
 
I would like to thank you for your snippet of code regarding my Enter Key Behavior problem.
No problem, glad to help and I even learned something new today because of your question.
I copied your code into my program exactly as you posted it. When I compiled the code, it gave me an error: “Expected: =”. I began playing with it and eventually removed the opening and closing parenthesis and
Yeah, VBA is funny that way. I may have called it slightly different, or because I tested in Access 2007 and you are in a different version it might have been slightly different.
I’m sure you are a guru and I am sure I have seen your name in some of the MS ACCESS manuals I have studied since 1996.
Not likely as I haven't written anything except responses on Access World Forums, Utter Access, MDB Makers, and the Microsoft newsgroups.
Please accept my whole hearted thanks and may you and yours have a very very Merry Christmas.
You are welcome. I am glad to be able to help. And Merry Christmas to you too! :)
 

Users who are viewing this thread

Back
Top Bottom