automatically select text of a combobox in access on click

G

googleDjango

when you click in a comboBox the text is not selected even if in the
event onClick you write the following code which works with a textBox:
(cBox is the name of the comboBox)
cBox.SelStart = 0
cBox.SelLength = Len(cBox.Text)

It looks like Access is sending an event after the onclick for the
cursor to go inside the text of the comboBox.

To succeed you have to put the code in the mouseUp event.
But this prevents you to select a part of the text.

To achieve this, declare a variable in the form module :
---------------
dim arrivalInCBox as Boolean

sub cBox_Enter()
arrivalInCBox =true
end sub

sub cBox_MouseUp()
if arrivalInCBox =True then
cBox.SelStart = 0
cBox.SelLength = Len(cBox.Text)
arrivalInCBox =False
end if
end sub
---------------
 

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