Combo Box On Click

T

tomocb

I can't get an On Click event to work with a combo box. It looks like it
automatically turns into an After Update event.

My Combo Box has two columns with the first column hidden because it is a
key field. The combo box is also displayed as a hyperlink so that the user
can click the list item value to open a form.

But I can get the On Click event to work if the user is selecting an
existing value in the combo box.

Any suggestions? Thanks in advance.
 
B

BruceM via AccessMonster.com

My observation as been that the Click event and the After Update events for
combo boxes are essentially (or maybe entirely) the same. If you describe
why you want to use the Click event it may be possible to suggest a solution.
 
T

tomocb

Thanks. I want the user to be able to click on the value in the combo box in
order to open a form that relates to that record. I do not want this
function to work when the combo box value is selected from the drop-down
list, which is why I can't use the After Update event.

E.g. the user goes into a form where a combo box has an existing value and
the user clicks on the value to open a related form.
 
B

BruceM via AccessMonster.com

I have to say I am mystified by inconsistencies such as this. There is no
effective Click event for a combo box, but you can use the Double Click event.
What's more, the Double Click event can be cancelled, but the Click event
cannot. I wonder if it was part of a plan, or if people weren't talking to
each other, or what exactly.

Anyhow, it looks as if the closest you can get is to use the combo box Double
Click event. Other than that you would need to use an event for a command
button or an unassociated label or some such.
Thanks. I want the user to be able to click on the value in the combo box in
order to open a form that relates to that record. I do not want this
function to work when the combo box value is selected from the drop-down
list, which is why I can't use the After Update event.

E.g. the user goes into a form where a combo box has an existing value and
the user clicks on the value to open a related form.
My observation as been that the Click event and the After Update events for
combo boxes are essentially (or maybe entirely) the same. If you describe
[quoted text clipped - 11 lines]
 
T

tomocb

It's true that the even does work when using On Dbl Click. I have just tried
it. This is good because it means that even if the value was previously
selected the user can double click the existing value to call the event to
open the form.

However, my preference is to use the On Click event, and I can't understand
why this won't work with a combo box!?

BruceM via AccessMonster.com said:
I have to say I am mystified by inconsistencies such as this. There is no
effective Click event for a combo box, but you can use the Double Click event.
What's more, the Double Click event can be cancelled, but the Click event
cannot. I wonder if it was part of a plan, or if people weren't talking to
each other, or what exactly.

Anyhow, it looks as if the closest you can get is to use the combo box Double
Click event. Other than that you would need to use an event for a command
button or an unassociated label or some such.
Thanks. I want the user to be able to click on the value in the combo box in
order to open a form that relates to that record. I do not want this
function to work when the combo box value is selected from the drop-down
list, which is why I can't use the After Update event.

E.g. the user goes into a form where a combo box has an existing value and
the user clicks on the value to open a related form.
My observation as been that the Click event and the After Update events for
combo boxes are essentially (or maybe entirely) the same. If you describe
[quoted text clipped - 11 lines]
Any suggestions? Thanks in advance.
 
T

tomocb

The On Enter and On Got Focus will call the event even if the user clicks on
the drop-down list of the combo box to select a new value. That does not
meet my requirements.

I simply need the control to fire an event with a single click on the
existing item list value.
 
D

Dirk Goldgar

tomocb said:
It's true that the even does work when using On Dbl Click. I have just
tried
it. This is good because it means that even if the value was previously
selected the user can double click the existing value to call the event to
open the form.

However, my preference is to use the On Click event, and I can't
understand
why this won't work with a combo box!?


For combo boxes, the Click and AfterUpdate events are both triggered when
the combo box's value is changed by the user in any way. I think that was
probably an intentional design choice, to make the Access combo box operate
similarly to the Visual Basic combo box. Programmers who were accustomed to
coding the Click event of the VB combo box to catch user updates would not
have to change their habits. That's just my theory, mind you -- I haven't
seen any explicit statement of this, and it has been like this since at
least Access 95.

What you could do, if you really want to make your combo box operate in this
manner, is put a transparent command button on top of the text portion of
the combo box. Set the button's Tab Stop property to No, so it can't be
tabbed into. Then use the Click event of the button to open the form you
want, based on the current value of the combo box.
 
T

tomocb

Thanks for all the comments guys.

While it looks like the On Click for a combo box doesn't behave as expected,
the Dbl Click event in hindsight would actually be better for me as
recommended earlier, because this gives the user the option to place the
cursor on the control for text editing.

Thanks again.
 

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