Why is text automatically highlighted?

Amy35

Registered User.
Local time
Today, 08:46
Joined
Mar 12, 2002
Messages
53
I have a form based off a query. There is only one field where a user can enter data. When the form is opened to the first record the text in that field is automatically highlighted so if a user accidentally hits a key, it wipes out the data. I've looked all through the properties and can't find why the data in that field (its a text box) is highlighted right when the form opens. Anyone know why?
Thanks!

Amy
 
All the other fields are already locked.

I also have the enabled field set to "no".

I have buttons in the footer section that are enabled and not locked.

Is there anything else that might be causing this? Thanks

Amy
 
Is this one active field the one you're worried about wiping out? Two possible solutions:
1) Under Tools>Options>Keyboard, you can change the behavior of the cursor when it enters a field. However this will change it for the entire database, not just this field...
2) Use the GotFocus and CLick events (you have to use both, don't ask me why) to change where the cursor goes for that field:
Code:
Private Sub HomePhone_Click()
    Me.ActiveControl.SelStart = 6
End Sub

Private Sub HomePhone_GotFocus()
    Me.ActiveControl.SelStart = 6
End Sub

In your case of course it will probably be SelStart = 0 to get to the start of the field.
 
I lock all fields and double click the field, unlocking and changing it's background color (to indicate it's going to be updated) I want to update. Then, On AfterUpdate of the field, I change it's background color back to its original color.

This works very well because a User can see where he is and what he is doing.
 
How about using tab order? Set the tab order to default to a locked field first (like the record number) and the user will have to tab into the one field they can edit. Also, if you have room and feel that another field won't clutter your form, you can add an unbound field for today's date. You'll have a nice little feature that the tab order can default to.
Stephen

[This message has been edited by StephenB (edited 05-02-2002).]
 

Users who are viewing this thread

Back
Top Bottom