Choosing parameters from a list.

M

Mich

Hi, I have created a form with several combo boxes. In the form I have built
a macro that opens a report with interactive parameters using the WHERE
clause. I would like to have the list from the combo boxes to be an option
to choose instead of the user typing in the paramater. Also if no parameter
is entered, how do I ensure that all data appears in the report. Right now
if nothing is entered the report is blank.
 
A

Allen Browne

If you leave the critiera out of the report's source query, and build up the
WhereCondition for OpenReport, you can test if the text box IsNull(). Just
leave it out of the WhereCondition string if it is.

If you need an example to follow, see:
Search form - Handle many optional criteria
at:
http://allenbrowne.com/ser-62.html
The example ends up applying the string as the filter for a form, but it's
identical for the WhereCondition of OpenReport.
 
M

Mich

I appreciate the tip. However I have not entered any criteria I have put
square brackets to have the interactive options. However the prompt still
only asks the user to enter the criteria not provide the list of values.

Any suggestions?
Here is my Where condition:
[Property Type]![Property Type] And [Property Type]![District]
--
Thank you,
Mich


Allen Browne said:
If you leave the critiera out of the report's source query, and build up the
WhereCondition for OpenReport, you can test if the text box IsNull(). Just
leave it out of the WhereCondition string if it is.

If you need an example to follow, see:
Search form - Handle many optional criteria
at:
http://allenbrowne.com/ser-62.html
The example ends up applying the string as the filter for a form, but it's
identical for the WhereCondition of OpenReport.
 
A

Allen Browne

The suggestion is to leave the criteria of of the query.
Instead, use a form, so the user can choose the criteria there.
That way you can use a combo or list box.

Once you have entered any criteria you want on the form, you click a button
to open the report. The button builds the WhereCondition string from the
criteria the user entered (ignoring any boxes they left blank), and opens
the report filtered to those records.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Mich said:
I appreciate the tip. However I have not entered any criteria I have put
square brackets to have the interactive options. However the prompt still
only asks the user to enter the criteria not provide the list of values.

Any suggestions?
Here is my Where condition:
[Property Type]![Property Type] And [Property Type]![District]
--
Thank you,
Mich


Allen Browne said:
If you leave the critiera out of the report's source query, and build up
the
WhereCondition for OpenReport, you can test if the text box IsNull().
Just
leave it out of the WhereCondition string if it is.

If you need an example to follow, see:
Search form - Handle many optional criteria
at:
http://allenbrowne.com/ser-62.html
The example ends up applying the string as the filter for a form, but
it's
identical for the WhereCondition of OpenReport.
 

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