Get Parameter from Another Control

  • Thread starter Thread starter FlyBoy
  • Start date Start date
F

FlyBoy

I have a form, on which is an option group with radio
buttons, a combo box, adn 2 command buttons. What I am
trying to achieve is a user selecting one of the radio
buttons, which will then limit the choices in the combo
box. I don't know how to feed the value from the option
group to a parameter in the query which populates the
combo box.

Any suggestions?
 
FlyBoy said:
I have a form, on which is an option group with radio
buttons, a combo box, adn 2 command buttons. What I am
trying to achieve is a user selecting one of the radio
buttons, which will then limit the choices in the combo
box. I don't know how to feed the value from the option
group to a parameter in the query which populates the
combo box.

Set the query's criteria to an expression that refers to the
option group. A trivial example:
Forms!theform.theoptiongroup

If that's too vague to get you going, post back with a
Copy/Paste of the query's SQL view and an explanation of how
the option group s supposed to affect the query results.
 
Marsh:

That works great. However, the problem I now have is that
when the form is first opened, you can pick a choice from
the option group, go to the combo box, hit the drop down,
and the results are correct. However, if you pick another
choice from the option group, then go to the combo box,
the first set of results are still showing. I'm sure I
need to put an onupdate or something somewhere, but I
don't know what to put where.

Thanks for the help.
 
FlyBoy:

Create a macro, set the Action to Requery, and the
Control Name to the name of your combo box. Fire this on
the On Got Focus event for the combo box.

Hope this helps.

John Cello
John Cello Consulting
Communications For Business
www.johncelloconsulting.com
 
FlyBoy said:
That works great. However, the problem I now have is that
when the form is first opened, you can pick a choice from
the option group, go to the combo box, hit the drop down,
and the results are correct. However, if you pick another
choice from the option group, then go to the combo box,
the first set of results are still showing. I'm sure I
need to put an onupdate or something somewhere, but I
don't know what to put where.


Add a line of code to the option group's AfterUpdate event
procedure:
Me.combobox.Requery

if the option group is bound to the form's record source
table/query, you will also want that line of code in the
form's Current event.
 
Back
Top