Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is this possible - Queries on a form filtered from list boxes 2

Status
Not open for further replies.

SAITIS

IS-IT--Management
Jan 26, 2010
4
PT
Hi,
I've been asked to make a form on a database and I'm not sure if what they want is possible.

The design that was suggested is open for discussion so it’s not final (jpg attached)...

I need to make a form that has 3 list boxes from 3 different tables (they have relationships between them) and after the selection of the values from the list boxes a “Run” button is pressed that will show the results from 3 different queries....

Is this possible? Even if I have a form with the 3 list boxes and the “Run” button and the queries open on a different form or 3 forms??

Best Regards
Nuno
 

In the WHERE section of your query grid, you can put something like =Forms!FormName!ListBoxName.
Depending on the size of the forms, you might want to consider using them as subforms on another form (I cannot see your example because of the filters in place at work).
Another possibility would be a tab control, with each subform on a different tab.


Randy
 
That is possible. No problem. Build three subforms and put them on an unbound mainform. Cancel the subform wizard because it will try to tell you that you can not put non-linked subforms on the mainform. The query for each subform uses the related listbox as the criteria for the query.
 
Thanks for the answers

I’ll try that :D
 
Hi,
So I’ve done what you said and it works :)
But now I have other questions...
1 - Is there any way that I can make multiple selections?? I've found the option on the proprieties of the list box but it doesn’t seem to save the selections...
2 - Is there any way that I can select all of the values if one of the lists boxes is empty??
My queries return the SUM of the fields depending on the selections of 5 list boxes, but I need to have the option of SUM all if only a list box is selected.
Thanks in advance
 
got to the Access Queries forum and click on FAQs. Scroll down to "Using Listboxes in Queries". There are several examples including a multi select listbox.
 
One other thing, which you may have to combine with the solutions

If you want to return all records if no value selected in the control (the control is null) then

[forms]![frmOne].[ctlName] Or [forms]![frmOne].[ctlName] Is Null

the second part of the or returns (null is null) thus returns all records when nothing selected.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top