By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,853 Members | 2,186 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,853 IT Pros & Developers. It's quick & easy.

Looping a query and using table data as parameter

P: n/a
I'm fairly new to Access and trying to figure out how to execute a
particulary query. For example I have 2 tables named TEST and TEST1.
TEST has a column labeled LETTERS with values A - Z. I want to
execute the query SELECT ALL FROM TEST1 WHERE LETTERS = TEST.LETTERS.
I want to reexecute the query for each record in the TEST1 table. Can
I do this directly in a query or do I have to write a module.

Any help would be appreciated.

Steve

May 16 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On May 16, 10:07 am, steve <s...@drodio.comwrote:
I'm fairly new to Access and trying to figure out how to execute a
particulary query. For example I have 2 tables named TEST and TEST1.
TEST has a column labeled LETTERS with values A - Z. I want to
execute the query SELECT ALL FROM TEST1 WHERE LETTERS = TEST.LETTERS.
I want to reexecute the query for each record in the TEST1 table. Can
I do this directly in a query or do I have to write a module.

Any help would be appreciated.

Steve
Go into query builder. Add both tables to the query. Click on the
LETTERS field in the TEST table and drag to the LETTERS fiedl in the
TEST1 query to create a JOIN. Now build your query pulling data from
TEST1 as you normally would.

This will give you all of the data in TEST1 that has a matching
LETTERS value in TEST. What it will omit is LETTERS that are in TEST
but not in TEST1. Thus if "L" was a LETTERS in TEST but nor record in
TEST1 had "L" as a value for LETTERS then "L" will not show up in yoru
result.

If you want to add ALL LETTERS in TEST and the matching data (if any)
in TEST1 you need a couple of minor modification.

First right click on the JOIN, click Join Properties, and select the
"select all items from'TEST"..." option. Then drop the LETTERS fiend
from TEST as the first field in yoru query.

May 16 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.