filter crosstab by listbox selection

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

Guest

I'm just curious if it is possible to filter a crosstab query (presented in a
listbox) by a selection in another listbox on a different form.

I try inserting the criteria - [forms]![search]![list15] - into the criteria
section on the QBE builder, but when i run the form by itself it says access
does not realize [forms]![search]![list15] as a valid expression... when ran
after its listbox 'parent' form, nothing appears.

Any help or suggestions would be great!
 
You must declare this parameter in your crosstab query.

Open the query in design view.
Choose Parameters from the Query menu.
In the dialog, enter:
[forms]![search]![list15] Long

The data type in the dialog should match the data type of the field you are
placing this expression under. For example, if it goes under a Text type
field, you declare Text instead of Long in the dialog.

Note that this approach will not work for a multi-select list box.
 
Thanks Allen, I've done this now, and things show up in the child listbox but
they are not specific to the selection in the parent listbox. It just reveals
all of the records. In this instance, the data is text.



Allen Browne said:
You must declare this parameter in your crosstab query.

Open the query in design view.
Choose Parameters from the Query menu.
In the dialog, enter:
[forms]![search]![list15] Long

The data type in the dialog should match the data type of the field you are
placing this expression under. For example, if it goes under a Text type
field, you declare Text instead of Long in the dialog.

Note that this approach will not work for a multi-select list box.

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

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

polisci grad said:
I'm just curious if it is possible to filter a crosstab query (presented
in a
listbox) by a selection in another listbox on a different form.

I try inserting the criteria - [forms]![search]![list15] - into the
criteria
section on the QBE builder, but when i run the form by itself it says
access
does not realize [forms]![search]![list15] as a valid expression... when
ran
after its listbox 'parent' form, nothing appears.

Any help or suggestions would be great!
 
never mind, fixed it....

by the way, if i wanted to make this work for multiselect listbox, would
this be possible? I have a sample of code i found for this at your website
under "Use a multiselect list box to filter a report".

Thanks for the help!


Allen Browne said:
You must declare this parameter in your crosstab query.

Open the query in design view.
Choose Parameters from the Query menu.
In the dialog, enter:
[forms]![search]![list15] Long

The data type in the dialog should match the data type of the field you are
placing this expression under. For example, if it goes under a Text type
field, you declare Text instead of Long in the dialog.

Note that this approach will not work for a multi-select list box.

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

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

polisci grad said:
I'm just curious if it is possible to filter a crosstab query (presented
in a
listbox) by a selection in another listbox on a different form.

I try inserting the criteria - [forms]![search]![list15] - into the
criteria
section on the QBE builder, but when i run the form by itself it says
access
does not realize [forms]![search]![list15] as a valid expression... when
ran
after its listbox 'parent' form, nothing appears.

Any help or suggestions would be great!
 
Back
Top