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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculated field based on existence in another query

Status
Not open for further replies.

simon1974

Technical User
Apr 2, 2002
43
US
Here is what I want to do --- Query1 has the same identical returned fields as Query2. The results are slightly different. I want to have, in Query2, an additional calculated field that returns an asterisk if the same record exists in Query1. If the record does not exist in Query1, then I want the field to contain a "?". Any ideas on how I can accomplish this? Thanks, any help is much appreciated!
 
(a) Create a third query. Lets Call it Query 3.
(b) Add Query1 and Query2 to this new Query3
(c) Add a join line between Query1 and Query2 by dragging between the key field(s) between Query1 and Query2.
(d) Double click on the join line(s) from Query1 to Query2 and select the Join Type which Includes "ALL records from Query2 ..."
(e) In your query field grid, in the field row of a new column, enter the following:

Q1Exists: iif(ISNull(Query1.KeyFld),"?","*")

(f) Add the other query fields as appropriate.
(g) Save and run the query

Hope this is enough to get you going,
Cheers,

Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top