List Box to provide variable in query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does anyone know of a way to create a query that utilizes a list/combo box to provide a variable? For instance... If I want to pull a report that shows me all the cartoons Bugs Bunny was in, when I run my query a list box would pop up and let me select from Bugs, Daffy, Porky, etc..
 
Normally, this would be done the other way around.

Example:
If you have a report that you want to filter with a listbox. You would
create a query to feed the report that refers to a listbox on a form as
criteria. (This would need to be a single select listbox or combobox to do
it this way, it can be done for a multiselect list box, but requires more
work.) You would open this form in the report's Open event using the
acDialog window mode argument to pause the code in the report. When you make
your selection in the listbox, you would then click a button on the form
that hides the form. This will allow the code in the report to resume
running. When the report calls the query, the query will get the value for
its parameter from the listbox on the hidden form.

The syntax for the criteria in the query would be similar to

Forms!MyForm!MyListbox

--
Wayne Morgan
Microsoft Access MVP


Pharo said:
Does anyone know of a way to create a query that utilizes a list/combo box
to provide a variable? For instance... If I want to pull a report that
shows me all the cartoons Bugs Bunny was in, when I run my query a list box
would pop up and let me select from Bugs, Daffy, Porky, etc..
 
Back
Top