ListO
Señor Member
- Local time
- Today, 23:31
- Joined
- Feb 2, 2000
- Messages
- 167
I’m simplifying this question for brevity. The real database is more complex, but I can apply a viable answer to my database.
I have created a database with several of tables, such as NAME, TASK, CATEGORY.
I have a main display query which selects a collection of data taken from those tables. My main display form is based on that query and it works great. BUT---
I want users to be able to make selections in a “filtering” form which will be applied to the query. The filtering form has pull-down boxes to make selections from any of three tables. It also has an “Exclude” checkbox for each of the table selections.
After making a selection from each pull-down, the chosen record ID# from that table is assigned toa global variable which I have used for filtering (pName, pSection, pCategory, pNameExcl, etc)
This is what I’d like to accomplish:
• If no Name is selected from the NAMES pull-down, the query should return all records.
• If a Name is selected from the NAMES pull-down, the query should return only records with the selected name.
• If a name is selected from NAMES pull-down and a section is selected from the SECTION pull-down, the query should return only records that have the selected Name and Section.
• If a name is selected from the NAMES table, and an “Exclude” checkbox is checked, the query should return only records without the selected name.
• If no NAME is selected, I want the query to return all names.
I have more than the three tables represented in the filtering form, so this can get even messier.
I have been doing this by creating a big table with a Make Table query, then culling that list with delete or update queries, but that is somewhat clumsy.
I have been using the query builder, as I’m not at all proficient with SQL.
Is there a graceful way to apply those global variables to the main query?
I have created a database with several of tables, such as NAME, TASK, CATEGORY.
I have a main display query which selects a collection of data taken from those tables. My main display form is based on that query and it works great. BUT---
I want users to be able to make selections in a “filtering” form which will be applied to the query. The filtering form has pull-down boxes to make selections from any of three tables. It also has an “Exclude” checkbox for each of the table selections.
After making a selection from each pull-down, the chosen record ID# from that table is assigned toa global variable which I have used for filtering (pName, pSection, pCategory, pNameExcl, etc)
This is what I’d like to accomplish:
• If no Name is selected from the NAMES pull-down, the query should return all records.
• If a Name is selected from the NAMES pull-down, the query should return only records with the selected name.
• If a name is selected from NAMES pull-down and a section is selected from the SECTION pull-down, the query should return only records that have the selected Name and Section.
• If a name is selected from the NAMES table, and an “Exclude” checkbox is checked, the query should return only records without the selected name.
• If no NAME is selected, I want the query to return all names.
I have more than the three tables represented in the filtering form, so this can get even messier.
I have been doing this by creating a big table with a Make Table query, then culling that list with delete or update queries, but that is somewhat clumsy.
I have been using the query builder, as I’m not at all proficient with SQL.
Is there a graceful way to apply those global variables to the main query?