E
Ed Robichaud
And where would you use/display the results of this select query? You're
using a combo box on your form to select filter criteria; do you then want
to show filtered records on that same form or subform, or perhaps run a
report?
One typical setup is to use an unbound combo box to filter display of
records based on value selected in the combo. Use the combo box wizard and
select the option to filter records.
Another setup is to pass the value from that unbound combo box to your
query.
In the design grid of your query, put a statement similar to:
Like IIf([forms]![frmMyForm]![cmbMyCombo] Is
Null,"*",[forms]![frmMyForm]![cmbMyCombo])
in the criteria row of the column you want to filter on. Also remove the
parameter statement - this is what causes the input box to display. Your
query will now select records based on the value showing in the form's combo
box, and display all records, if there is no selection.
To run the query directly from your form, you'll need a
DoCmd.RunQuery "MyQuery"
statement that is put in the AfterUpdate event of your combo box, or better
still on the OnClick event of a command button that you add (there's a
command button wizard to help you).
-Ed
using a combo box on your form to select filter criteria; do you then want
to show filtered records on that same form or subform, or perhaps run a
report?
One typical setup is to use an unbound combo box to filter display of
records based on value selected in the combo. Use the combo box wizard and
select the option to filter records.
Another setup is to pass the value from that unbound combo box to your
query.
In the design grid of your query, put a statement similar to:
Like IIf([forms]![frmMyForm]![cmbMyCombo] Is
Null,"*",[forms]![frmMyForm]![cmbMyCombo])
in the criteria row of the column you want to filter on. Also remove the
parameter statement - this is what causes the input box to display. Your
query will now select records based on the value showing in the form's combo
box, and display all records, if there is no selection.
To run the query directly from your form, you'll need a
DoCmd.RunQuery "MyQuery"
statement that is put in the AfterUpdate event of your combo box, or better
still on the OnClick event of a command button that you add (there's a
command button wizard to help you).
-Ed