"Enter" key moving to next field

  • Follow


Using Access 2003, what sort of command should I issue in my VBA code to set 
the option to cause the "Enter" key to move to the next field?

bob 


0
Reply Bob 3/19/2008 12:03:37 AM

follow-up --- I want this to work in Access 2007 environments as well since 
some of my users have A2K7 on their computers.


"Bob Howard" <info@churchtrax.com> wrote in message 
news:%238NwzRViIHA.4080@TK2MSFTNGP03.phx.gbl...
> Using Access 2003, what sort of command should I issue in my VBA code to 
> set the option to cause the "Enter" key to move to the next field?
>
> bob
> 


0
Reply Bob 3/19/2008 12:05:07 AM


Bob Howard wrote:
> follow-up --- I want this to work in Access 2007 environments as well
> since some of my users have A2K7 on their computers.
>
>
> "Bob Howard" <info@churchtrax.com> wrote in message
> news:%238NwzRViIHA.4080@TK2MSFTNGP03.phx.gbl...
>> Using Access 2003, what sort of command should I issue in my VBA
>> code to set the option to cause the "Enter" key to move to the next
>> field? bob

That is the default behavior so just don't change it and you need no code 
whatsoever.

-- 
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com


0
Reply Rick 3/19/2008 12:18:52 AM

Depending on how each of my users has this option set, my program will 
respond differently.  I want my program to respond the same, regardless.

And a large percentage of my users have a Runtime edition of Access ... so 
they cannot set this option anyway.

So my question remains --- how do I set it via VBA?

bob

"Rick Brandt" <rickbrandt2@hotmail.com> wrote in message 
news:EZYDj.4356$qS5.2425@nlpi069.nbdc.sbc.com...
> Bob Howard wrote:
>> follow-up --- I want this to work in Access 2007 environments as well
>> since some of my users have A2K7 on their computers.
>>
>>
>> "Bob Howard" <info@churchtrax.com> wrote in message
>> news:%238NwzRViIHA.4080@TK2MSFTNGP03.phx.gbl...
>>> Using Access 2003, what sort of command should I issue in my VBA
>>> code to set the option to cause the "Enter" key to move to the next
>>> field? bob
>
> That is the default behavior so just don't change it and you need no code 
> whatsoever.
>
> -- 
> Rick Brandt, Microsoft Access MVP
> Email (as appropriate) to...
> RBrandt   at   Hunter   dot   com
>
> 


0
Reply Bob 3/19/2008 4:25:16 AM

On Tue, 18 Mar 2008 21:25:16 -0700, Bob Howard wrote:

> Depending on how each of my users has this option set, my program will 
> respond differently.  I want my program to respond the same, regardless.
> 
> And a large percentage of my users have a Runtime edition of Access ... so 
> they cannot set this option anyway.
> 
> So my question remains --- how do I set it via VBA?
> 
> bob
> 
> "Rick Brandt" <rickbrandt2@hotmail.com> wrote in message 
> news:EZYDj.4356$qS5.2425@nlpi069.nbdc.sbc.com...
>> Bob Howard wrote:
>>> follow-up --- I want this to work in Access 2007 environments as well
>>> since some of my users have A2K7 on their computers.
>>>
>>>
>>> "Bob Howard" <info@churchtrax.com> wrote in message
>>> news:%238NwzRViIHA.4080@TK2MSFTNGP03.phx.gbl...
>>>> Using Access 2003, what sort of command should I issue in my VBA
>>>> code to set the option to cause the "Enter" key to move to the next
>>>> field? bob
>>
>> That is the default behavior so just don't change it and you need no code 
>> whatsoever.
>>
>> -- 
>> Rick Brandt, Microsoft Access MVP
>> Email (as appropriate) to...
>> RBrandt   at   Hunter   dot   com
>>
>>

Using VBA, you can cycle through the database's form's collection,
opening, in turn, each form in Design View acHidden, and set the
EnterKeyBehavior property for each text control to False (False is
Default, True is New Line in field). Then close the form acSaveYes.
If you need any help with the actual code, post back.

However, if the user is using a runtime, they can't change the setting
from your original Default, so this won't affect them.
-- 
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
0
Reply fredg 3/19/2008 6:05:34 AM

> And a large percentage of my users have a Runtime edition of Access ... so
> they cannot set this option anyway.

Since they can't change this, then you are safe with the default...

However, here is code solution:

 Application.SetOption "Move After Enter", 1

The tools->options, and then keyboard tab

0 = Don't move
1 = next field
2 = next record

In a2003 to find all of the settings as above, the help is REALLY REEALLY
nice in this regards.

From VBA editor, go help-> and then search for:

set options in vba

The first hit is :

Set Options from Visual Basic

Choose the above, and you find a REALLY nice gem of a help topic on how to
set/get any of the values you see in the tools->options tab.

Here is a few common settings I use...even for runtime apps:

   Application.SetOption "ShowWindowsInTaskbar", False
   Application.SetOption "Themed Form Controls", True
   Application.SetOption "Show Startup Dialog Box", False
   Application.CommandBars.AdaptiveMenus = False

-- 
Albert D. Kallal    (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com 


1
Reply Albert 3/19/2008 8:49:35 AM

Thanks Albert --- that did it ! ! !

bob

"Albert D. Kallal" <PleaseNOOOsPAMmkallal@msn.com> wrote in message 
news:eqxFp4ZiIHA.4744@TK2MSFTNGP06.phx.gbl...
>> And a large percentage of my users have a Runtime edition of Access ... 
>> so
>> they cannot set this option anyway.
>
> Since they can't change this, then you are safe with the default...
>
> However, here is code solution:
>
> Application.SetOption "Move After Enter", 1
>
> The tools->options, and then keyboard tab
>
> 0 = Don't move
> 1 = next field
> 2 = next record
>
> In a2003 to find all of the settings as above, the help is REALLY REEALLY
> nice in this regards.
>
> From VBA editor, go help-> and then search for:
>
> set options in vba
>
> The first hit is :
>
> Set Options from Visual Basic
>
> Choose the above, and you find a REALLY nice gem of a help topic on how to
> set/get any of the values you see in the tools->options tab.
>
> Here is a few common settings I use...even for runtime apps:
>
>   Application.SetOption "ShowWindowsInTaskbar", False
>   Application.SetOption "Themed Form Controls", True
>   Application.SetOption "Show Startup Dialog Box", False
>   Application.CommandBars.AdaptiveMenus = False
>
> -- 
> Albert D. Kallal    (Access MVP)
> Edmonton, Alberta Canada
> pleaseNOOSpamKallal@msn.com
> 


0
Reply Bob 3/19/2008 9:16:17 AM

Bob Howard wrote:
> Depending on how each of my users has this option set, my program will
> respond differently.  I want my program to respond the same,
> regardless.

Perhaps they changed this on newer versions.  In previous ones it is not a 
user-specific Access level setting.  It is a setting per-control on your 
forms and the default is to move to the next field.

If they changed it to an Access level setting then you really have no 
business mucking with the user's preference anyway.

-- 
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com 


0
Reply Rick 3/19/2008 11:32:04 AM

"Rick Brandt" <rickbrandt2@hotmail.com> wrote in message 
news:LQ6Ej.5436$Rq1.3127@nlpi068.nbdc.sbc.com...
> Bob Howard wrote:
>> Depending on how each of my users has this option set, my program will
>> respond differently.  I want my program to respond the same,
>> regardless.
>
> Perhaps they changed this on newer versions.  In previous ones it is not a 
> user-specific Access level setting.  It is a setting per-control on your 
> forms and the default is to move to the next field.
>
> If they changed it to an Access level setting then you really have no 
> business mucking with the user's preference anyway.
>
> -- 
> Rick Brandt, Microsoft Access MVP
> Email (as appropriate) to...
> RBrandt   at   Hunter   dot   com
>

Rick, I see no setting in the controls regarding this option (my controls 
are a mixture of combo boxes and text boxes).

bob 


0
Reply Bob 3/19/2008 2:50:33 PM

"Bob Howard" <info@churchtrax.com> wrote in message 
news:O7jGVCdiIHA.5968@TK2MSFTNGP04.phx.gbl...
>
> "Rick Brandt" <rickbrandt2@hotmail.com> wrote in message 
> news:LQ6Ej.5436$Rq1.3127@nlpi068.nbdc.sbc.com...
>> Bob Howard wrote:
>>> Depending on how each of my users has this option set, my program will
>>> respond differently.  I want my program to respond the same,
>>> regardless.
>>
>> Perhaps they changed this on newer versions.  In previous ones it is not 
>> a user-specific Access level setting.  It is a setting per-control on 
>> your forms and the default is to move to the next field.
>>
>> If they changed it to an Access level setting then you really have no 
>> business mucking with the user's preference anyway.
>>
>
> Rick, I see no setting in the controls regarding this option (my controls 
> are a mixture of combo boxes and text boxes).

Look on the Other tab in the Properties window of your text boxes.

-- 
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



0
Reply Douglas 3/19/2008 3:31:43 PM

"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message 
news:%23VHvWZdiIHA.4076@TK2MSFTNGP05.phx.gbl...
> "Bob Howard" <info@churchtrax.com> wrote in message 
> news:O7jGVCdiIHA.5968@TK2MSFTNGP04.phx.gbl...
>>
>> "Rick Brandt" <rickbrandt2@hotmail.com> wrote in message 
>> news:LQ6Ej.5436$Rq1.3127@nlpi068.nbdc.sbc.com...
>>> Bob Howard wrote:
>>>> Depending on how each of my users has this option set, my program will
>>>> respond differently.  I want my program to respond the same,
>>>> regardless.
>>>
>>> Perhaps they changed this on newer versions.  In previous ones it is not 
>>> a user-specific Access level setting.  It is a setting per-control on 
>>> your forms and the default is to move to the next field.
>>>
>>> If they changed it to an Access level setting then you really have no 
>>> business mucking with the user's preference anyway.
>>>
>>
>> Rick, I see no setting in the controls regarding this option (my controls 
>> are a mixture of combo boxes and text boxes).
>
> Look on the Other tab in the Properties window of your text boxes.
>
> -- 
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
>

That seems to be a different option... the option you're referring to seems 
to be how Access reacts when entering a field.

I'm looking at the option that causes the "Enter" key to cause Access to 
move from field to field within a record ... and that seems to be something 
I set in the Access options screen.

bob 


0
Reply Bob 3/19/2008 4:18:43 PM

Bob Howard wrote:
> That seems to be a different option... the option you're referring to
> seems to be how Access reacts when entering a field.
>
> I'm looking at the option that causes the "Enter" key to cause Access
> to move from field to field within a record ... and that seems to be
> something I set in the Access options screen.

I am looking right at it and the property is called "Enter Key Behavior". 
The choices are "default" and "new line in field".  It does not exist on 
ComboBoxes. ListBoxes, or CheckBoxes, but does on TextBoxes.

Here is the help file topic...


0
Reply Rick 3/20/2008 12:03:14 AM

Rick Brandt wrote:
> Bob Howard wrote:
>> That seems to be a different option... the option you're referring to
>> seems to be how Access reacts when entering a field.
>>
>> I'm looking at the option that causes the "Enter" key to cause Access
>> to move from field to field within a record ... and that seems to be
>> something I set in the Access options screen.
>
> I am looking right at it and the property is called "Enter Key
> Behavior". The choices are "default" and "new line in field".  It
> does not exist on ComboBoxes. ListBoxes, or CheckBoxes, but does on
> TextBoxes.
> Here is the help file topic...

Sorry - prematurely sent last message.  Here is the help file topic...

You can use the EnterKeyBehavior property to specify what happens when you 
press ENTER in a text box control in Form view or Datasheet view. For 
example, you can use this property if you have a control bound to a Memo 
field in a table to make entering multiple-line text easier. If you don't 
set this property to New Line In Field, you must press CTRL+ENTER to enter a 
new line in the text box.

Setting

The EnterKeyBehavior property uses the following settings.

Default (Default)
Microsoft Access uses the result specified under Move After Enter on the 
Keyboard tab of the Options dialog box, available by clicking Options on the 
Tools menu. For details, see the Remarks section. False (0)

New Line In Field
Pressing ENTER in the control creates a new line in the control so you can 
enter additional text. True (�1)

You can set this property by using a form's property sheet, a macro, or 
Visual Basic.  You can set the default for this property by using the 
control's default control style or the DefaultControl method in Visual 
Basic.

Remarks

The following options are available under Move After Enter on the Keyboard 
tab of the Options dialog box.

Option Description
Don't Move Pressing ENTER has no effect.
Next Field Pressing ENTER moves the insertion point to the next control or 
field in the form or datasheet in the tab order.
Next Record Pressing ENTER moves the insertion point to the first control or 
field in the next record on the form or datasheet.

-- 
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com 


0
Reply Rick 3/20/2008 12:06:53 AM

"Rick Brandt" <rickbrandt2@hotmail.com> wrote in message 
news:nUhEj.1207$p24.144@nlpi061.nbdc.sbc.com...
> Rick Brandt wrote:
>> Bob Howard wrote:
>>> That seems to be a different option... the option you're referring to
>>> seems to be how Access reacts when entering a field.
>>>
>>> I'm looking at the option that causes the "Enter" key to cause Access
>>> to move from field to field within a record ... and that seems to be
>>> something I set in the Access options screen.
>>
>> I am looking right at it and the property is called "Enter Key
>> Behavior". The choices are "default" and "new line in field".  It
>> does not exist on ComboBoxes. ListBoxes, or CheckBoxes, but does on
>> TextBoxes.
>> Here is the help file topic...
>
> Sorry - prematurely sent last message.  Here is the help file topic...
>
> You can use the EnterKeyBehavior property to specify what happens when you 
> press ENTER in a text box control in Form view or Datasheet view. For 
> example, you can use this property if you have a control bound to a Memo 
> field in a table to make entering multiple-line text easier. If you don't 
> set this property to New Line In Field, you must press CTRL+ENTER to enter 
> a new line in the text box.
>
> Setting
>
> The EnterKeyBehavior property uses the following settings.
>
> Default (Default)
> Microsoft Access uses the result specified under Move After Enter on the 
> Keyboard tab of the Options dialog box, available by clicking Options on 
> the Tools menu. For details, see the Remarks section. False (0)
>
> New Line In Field
> Pressing ENTER in the control creates a new line in the control so you can 
> enter additional text. True (-1)
>
> You can set this property by using a form's property sheet, a macro, or 
> Visual Basic.  You can set the default for this property by using the 
> control's default control style or the DefaultControl method in Visual 
> Basic.
>
> Remarks
>
> The following options are available under Move After Enter on the Keyboard 
> tab of the Options dialog box.
>
> Option Description
> Don't Move Pressing ENTER has no effect.
> Next Field Pressing ENTER moves the insertion point to the next control or 
> field in the form or datasheet in the tab order.
> Next Record Pressing ENTER moves the insertion point to the first control 
> or field in the next record on the form or datasheet.
>
> -- 
> Rick Brandt, Microsoft Access MVP
> Email (as appropriate) to...
> RBrandt   at   Hunter   dot   com
>
Thanks.  That final option was what I was after as what I wanted to do was 
to set it to "Next Field" within the VBA code.  Albert Kallal previously 
responded with the code I was after and it's working.  Bob 


0
Reply Bob 3/20/2008 8:59:32 PM

13 Replies
1207 Views

(page loaded in 0.337 seconds)




Reply: