Using forms to enter criterea for query

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

Guest

Hello,

I tried posting this earlier, but I cant find my post nor
any replies anywhere. I Apologize if this has already been
answered and overlooked by me.

I want to choose critereas for my query from a listbox in
a form that I've made. It works fine as long as I choose
only one item in the listbox, but If I choose more than
one, the query doesnt work.

Anyone have any Ideas?

I probably have to use VBA, but I need to get a push in
the right direction to figure out how to make the code.

Baard
 
Very good article, but I have one more question.

Should the code go with the listbox, or the hidden control
in which the query gets its parameters from?

I havent been able to make it work.

Baard Dahl
 
Wherever appropriate, I suppose.

For example, if I want to print a Report using the Parametrized Query as the
RecordSource, I would have a CommandButton to print the Report. In the
CommandButton_Click Event Procedure, I would run the posted code to assign
the WHERE String to the hidden TextBox Control and then use the OpenReport
Method to call the Report.

Alternatively, I can simply modify the SQL String of the Query directly
without using the hidden TextBox Control to have the criteria explicitly set
using similar to the posted code and then use the OpenReport Method.
 
Back
Top