|
 |
access thread: Generating Reports & Queries based on multiple values on listbox
Message #1 by "Howie Thai" <hhthai@u...> on Tue, 30 Jul 2002 02:28:05
|
|
Currently, when a user selects a report, it opens a form where the user
needs to select values from various combo boxes. Then the user clicks "OK"
and the report generates.
However, combo boxes don't serve my needs anymore. I need to select
multiple values from a listbox. I then need my report to generate based on
the values selected.
I'm testing a form that having a listbox, "lstCompanyID" and a
textbox, "txtCompanyID". When the user selects multiple values from the
listbox, the selections appear on the textbox. I then have a query that
pulls the values from the textbox, i.e., [Forms]![frmUserCriteria]!
[txtCompanyID]. The report generates from this query.
However, my query only works if I make one selection. If I make more than
one selection, it gives me an error messages stating that the value is too
complicated for the query. For example, I need to see data for company 123
and company 789. In a simple form, the query will pull data for those
companies if my criteria for the companyID field is, "123" or "789".
However, the query does not seem to be able to translate my selections
from the textbox into this format. Thus, it doesn't work.
Can anyone help? I really need help big-time.
Thanks,
Howie
Message #2 by jose.johnson@j... on Tue, 30 Jul 2002 10:42:38 +0900
|
|
To achieve this, you have to put little more efforts to get the selected
items from the Listbox.
The one you are currently doing is only fine for single selection. If you
have to use multiple
selected list box, before you go the report generation, just find out all
the items selected
in the list box and just write back to a temp table. By doing this, you
can get all the items
currently selected by the user into the temp table.
Now your query parameter shall be based on that temp table by using an
"In(select * from tblTemp)"
instead of the form based listbox variable.
I hope this will work.
hhthai@u...
om To: access@p...
cc:
07/30/2002 11:28 Subject: [access] Generating Reports & Queries based on multiple values on
listbox
AM
Please respond to
access
Currently, when a user selects a report, it opens a form where the user
needs to select values from various combo boxes. Then the user clicks "OK"
and the report generates.
However, combo boxes don't serve my needs anymore. I need to select
multiple values from a listbox. I then need my report to generate based on
the values selected.
I'm testing a form that having a listbox, "lstCompanyID" and a
textbox, "txtCompanyID". When the user selects multiple values from the
listbox, the selections appear on the textbox. I then have a query that
pulls the values from the textbox, i.e., [Forms]![frmUserCriteria]!
[txtCompanyID]. The report generates from this query.
However, my query only works if I make one selection. If I make more than
one selection, it gives me an error messages stating that the value is too
complicated for the query. For example, I need to see data for company 123
and company 789. In a simple form, the query will pull data for those
companies if my criteria for the companyID field is, "123" or "789".
However, the query does not seem to be able to translate my selections
from the textbox into this format. Thus, it doesn't work.
Can anyone help? I really need help big-time.
Thanks,
Howie
|
|
 |