473,405 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Help with using a subquery to filter on multiple tables using asingle form

Hi all--
Does anyone have any insight as to how I might create a search form
that allows a user to select criteria based on any related table in
the whole database. The search form I have now only allows me to
filter based on variables in a single table. I would like to have a
search form where I can select multiple variables (from various linked
tables) to filter by, and return results based on this multi-table
filter.

Allen Browne has a wonderful description of how to create a simple
search form: <http://www.allenbrowne.com/ser-62.html>, and he even
alludes to a way "to filter on other tables that are not even in the
form's RecordSource, use a subquery" -- on his subquery page (<http://
www.allenbrowne.com/subquery-01.html#Search>), he describes using
subqueries in the context of his simple search form to create a search
form "where the user can select criteria based on any related table in
the whole database". I was wondering if anyone had some thoughts as to
how I might actually code something like that (basically, how to code
a search form similar to that which he has on the bottom of his
subquery-01.html page).

thanks,
-jason
Dec 20 '07 #1
1 4119
Hi Jason

There is a significant amount of code to write to handle such as search
form.

For example, the screenshot shows the Donations, so the code has to visit
each of the contorls you see on that page, and build a WHERE clause to use
in the subquery for the Donations table that covers each of those
conditions. You actually build up the WHERE clause for the subquery in the
same way you built the strWhere string for the search form here:
http://allenbrowne.com/ser-62.html

You then create a massive top-level query statement for the results. Its
WHERE clause contains all the subqueries for the tables the user chose to
put criteria in. So in the end, the query statement ends up like this:
SELECT tblClient.* FROM tblClient
WHERE EXISTS (SELECT DonationID FROM tblDonation
WHERE tblDonation.ClientID = tblClientID
AND tblDonation.DonationDate #1/1/2007#)
AND EXISTS (SELECT ...

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<jc****@gmail.comwrote in message
news:12**********************************@d21g2000 prf.googlegroups.com...
Hi all--
Does anyone have any insight as to how I might create a search form
that allows a user to select criteria based on any related table in
the whole database. The search form I have now only allows me to
filter based on variables in a single table. I would like to have a
search form where I can select multiple variables (from various linked
tables) to filter by, and return results based on this multi-table
filter.

Allen Browne has a wonderful description of how to create a simple
search form: <http://www.allenbrowne.com/ser-62.html>, and he even
alludes to a way "to filter on other tables that are not even in the
form's RecordSource, use a subquery" -- on his subquery page (<http://
www.allenbrowne.com/subquery-01.html#Search>), he describes using
subqueries in the context of his simple search form to create a search
form "where the user can select criteria based on any related table in
the whole database". I was wondering if anyone had some thoughts as to
how I might actually code something like that (basically, how to code
a search form similar to that which he has on the bottom of his
subquery-01.html page).

thanks,
-jason
Dec 21 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Andrew McNab | last post by:
Hi folks, I have a problem with an MS Access SQL query which is being used in an Access Report, and am wondering if anyone can help. Basically, my query (shown below) gets some records from a...
5
by: Steve Patrick | last post by:
Hi All You guys are my last hope, despite spending money on books and hours reading them I still can not achieve the results I need. I have designed a database in Access 2000 based on 1 table,...
4
by: Kathy | last post by:
What is the standard technique for handling the fields in the following scenario on a continuous form? Multiple Divisions. Each Division has multiple Buildings. Each Building has a Supervisor. ...
15
by: shaqattack1992-newsgroups | last post by:
Hello Everyone, Let me explain my problem. I have included 2 dashes between each pair of records to make it easier to see what goes together. In reality, it is just a long list of results...
7
by: Jeff | last post by:
Hi - For my VB.NET app, I have a SQL2K database that I use to create a dataset with multiple data tables. I've created a dataview (dvReportsTo) of one of the tables, SCPMaster, and I've bound a...
0
by: lordofhyphens | last post by:
I'm trying to form a correlated subquery (right now, it's MS Access running to linked tables in MS SQL, although I have tried to make the same query against the MS SQL tables directly). The goal...
0
by: anonieko | last post by:
This approach I found very efficient and FAST when compared to the rowcount, or Subquery Approaches. This is before the advent of a ranking function from DB such as ROW_NUMBER() in SQL Server...
0
by: Chuck36963 | last post by:
Hi all, I've been working on a listing problem and I can't figure out how to work it out. I have looked far and wide on the web to find answers, but I'd like other peoples input on my project in...
3
by: jcf378 | last post by:
Hi all-- Does anyone have any insight as to how I might create a search form that allows a user to select criteria based on any related table in the whole database. The search form I have now only...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.