Enable/disable alternate 2 combo boxes

L

LuisSa

Hi all,
Would appreciate some help.
I have 2 combo boxes which I would like to have alternatively enabled, this
is when after updating one would disable the other and vice-versa and to be
aplicable to each record.
I could do this but woul apply to all records.
Can anybody help me? Thanks.
 
M

Maurice

This would depend on the kind of form you have. In case of a 'regular' form.

in the afterupdate of the combo disable the one you'd like to disable so:

me.combo1.enabled=not me.combo2.enabled
'-This would enable the combo depending on the other one

In the OnCurrent of the form you'd need to set the combo's back to their
original state to do the same for other records.

So in the OnCurrent place something like:
me.combo1.enabled=true
me.combo2.enabled=true

hth
 
L

LuisSa

Hi Maurice,
Sorry but does not work.
Seems pretty simple, but does not work...
After selecting the option in the first combo box, pops up the following
message:
Error 2164: "you can't disable a control while it has the focus"
Any help?
Luis
 
M

Maurice

Luis,

reuse the code but make sure that before you disable the control that you
set the focus to another control otherwise you'll get the error you're
receive now.

So an additional line could be to place the focus on the control that you
don't want to disable or place the focus to a button

me.control.setfocus (where control is the name of the control you want to
set the focus to)

me.control.setfocus
me.combo1.enabled=not me.combo2.enabled

hth
 

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