"Enter key" default

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

The A2003 default on forms when the enter
key is pressed following entry of text in a
text box is to clear the field, or at least it
appears to be the default. Where's the
setting where the enter key would otherwise
be the equivalent of pressing the tab key
or moving the focus with the mouse.......
something other than clearing what was
just typed.

Thanks,
Bill
 
On the text box's property dialog, on the 'other' tab, look for Enter Key
Behavior.
You have a choice of Default or New Line in Field.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
Jeanette,
I guess my question is how to change the default. I didn't
want to necessarily change all the text boxes on the form
individually.
Bill
California, USA
 
Here is some code that will do that.

-------------
Public Function ChangeSomethingOnControl()
Dim aob As AccessObject
Dim frm As Form
Dim ctl As control

' Ignore any errors
On Error Resume Next
' Loop through all the forms
For Each aob In CurrentProject.AllForms
' Open the form in Design view, but hidden
DoCmd.OpenForm aob.Name, acDesign, , , , acHidden
' Point to the form
Set frm = Forms(aob.Name)
' Loop through all controls
For Each ctl In frm.Controls
If TypeOf ctl Is TextBox Then
ctl.Properties("EnterKeyBehavior") = False 'default
End If

Next ctl
' Clear the control object
Set ctl = Nothing
' Close and save any changes
DoCmd.Close acForm, aob.Name, acSaveNo
Next aob
' Clear the Access object
Set aob = Nothing
' .. and the Form object
Set frm = Nothing
MsgBox "Done"
End Function
 
Back
Top