Edit field

  • Thread starter Thread starter Garry Jones
  • Start date Start date
G

Garry Jones

When I activate a field in a form it is highlighted and at first click
the users loses the previous entry. Sometimes the user just wants to
correct a spelling mistake. Any simple way of getting fields to open
with the cursor at postion 1 and the previous entry not highlighted?

Garry Jones
Sweden
 
add the following code to the form's Open event procedure, as

Application.SetOption "Behavior Entering Field", 1

and the following code to the form's Close event procedure, as

Application.SetOption "Behavior Entering Field", 0

the first action sets the behavior for the whole database (possibly for all
other dbs opened on that PC, as well - i didn't test it). so the second
action sets the behavior back to the default when the form is closed.

if you don't know how to add an event procedure to a form, see "Create a VBA
event procedure" at http://home.att.net/~california.db/instructions.html for
illustrated instructions.

hth
 
If you want to do this for only one control, you can use the Got Focus Event
to modify the behavior for that control. For instance, with a control named
fText

Private Sub fText_GotFocus()
Me.fText.SelLength =0
Me.fText.SelStart=0
End Sub
 
Back
Top