Report Critera

A

Abdul Shakeel

Hi All,

I have a report whcih contains customer Names, on report Header and details
Like Date, order number, units, rate, qty etc. in detail section when I open
the report a popup form appears and ask for StartDate, EndDate & have a list
contains all customers names to be enter, I want that in me customer List if
I enable MultiSelect to Expanded & then I Select more then one customer
report should show order detail of all selected customers. so what would be
the parameter query in this situation.
 
A

Allen Browne

A parameter query cannot handle multiple items in a multi-select list box.

You will need to use the WhereCondition of OpenReport, or build a filter
string to apply in the report's Open event.

For an example of how to write that code, see:
Use a multi-select list box to filter a report
at:
http://allenbrowne.com/ser-50.html
 
A

Abdul Shakeel

Allen

Your Code work properly but Allen is there any easy way to do things like
this or you could explain your code in detail so I could apply easily in my
databases with ease.
 
A

Allen Browne

You want an explanation beyond what is present at:
http://allenbrowne.com/ser-50.html

The core idea is that a multi-select list box has an ItemsSelected
collection. You can loop through the items in that collection to list the
items that are currently selected in the list box.

The For ... Next loop does that. varItem is the item number. ItemData()
gives you the data in that item. Inside the loop, this value is appended to
the string strWhere, so ultimately this string will contain a list such as:
"dog", "cat", "fish", "bird",

After the loop, the code removes the trailing comma, and prepends the string
so it finishes up like this:
[CatagoryID] IN ("dog", "cat", "fish", "bird")
That's a valid WHERE clause in a query, so you can use that expression as a
WhereCondition for OpenReport. The report doesn't need criteria in its
source query: the filtering is done by the 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