EnterKeyBehavior Property

Microsoft Access Visual Basic

EnterKeyBehavior Property

       

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. Read/write Boolean.

expression.EnterKeyBehavior

expression   Required. An expression that returns one of the objects in the Applies To list.

Remarks

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.

The EnterKeyBehavior property uses the following settings.

Setting Visual Basic Description
Default False   (Default) Microsoft Access uses the result specified under Move after enter area on the Keyboard tab of the Options dialog box, available by clicking Options on the Tools menu. For details, see the Remarks section.
New Line In Field True   Pressing ENTER in the control creates a new line in the control so you can enter additional text.
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.

The following options are available under Move after enter area 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.