Selecting entire field

W

WSF

Access 97
I'm struggling with this one. I have a list box with Limit To List set
to Yes. On the Not In List event procedure I have:

Private Sub lstCallType_NotInList(NewData As String, Response As Integer)
MsgBox "You must select from the list!", vbExclamation, "Sorry!"
Response = acDataErrContinue
End Sub

That works okay, but I would like to return to the list box and have the
entire contents highlighted so the operator can over-write the incorrect
entry. I can return the focus to the lstbox okay but cannot get it to
select the entire filed content.

Unless there is another way of doing this?
I have tried variations of:

Me!lstCallType.SelStart = 0
Me!lstCallType.SelLength = Len(Me!lstCallType.Text)
Me!lstCallType.Dropdown

at OnEnter, GotFocus etc..

with the idea being the operator can simply start typing the correct
selection.

In some cases the selection is a single character, but the cursor always
ends up at the end of the field.

Any ideas gratefully appreciated.

WSF
 
M

Marshall Barton

WSF said:
Access 97
I'm struggling with this one. I have a list box with Limit To List set
to Yes. On the Not In List event procedure I have:

Private Sub lstCallType_NotInList(NewData As String, Response As Integer)
MsgBox "You must select from the list!", vbExclamation, "Sorry!"
Response = acDataErrContinue
End Sub

That works okay, but I would like to return to the list box and have the
entire contents highlighted so the operator can over-write the incorrect
entry. I can return the focus to the lstbox okay but cannot get it to
select the entire filed content.

Unless there is another way of doing this?
I have tried variations of:

Me!lstCallType.SelStart = 0
Me!lstCallType.SelLength = Len(Me!lstCallType.Text)
Me!lstCallType.Dropdown

at OnEnter, GotFocus etc..

with the idea being the operator can simply start typing the correct
selection.


Put those lines of code in your NotInList event procedure.

You may want to consider using Me.lstCallType.Undo instead
of selecting the existing text.
 
W

WSF

Another gentleman and scholar!
Fixed - Undo it is!
Thank's Marshall and a Happy New Year to you.

Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top