Check for active records in a table

pjg34711

Registered User.
Local time
Today, 11:07
Joined
Sep 7, 2012
Messages
11
I need to compare records in a table to a table of active records so that I can only choose actiive records from the initial table. Any help would be greatly appreciated!
 
If these two tables have a foreign key relationship, use

select <something> from <table1> where exists (select 1 from table2 where <somekeyfield> = table1.<relatedkeyfield>)

In VBA.

Running this SQL will give you the records for which an active record exists.
 
Accessensible - Jet/ACE are not well optimized for subqueries so I wouldn't use them unless a join won't do the job. In this case a join will work fine.

Select ... From tblA Inner Join tblB ON tblA.PK = tblB.FK;
 
Thanks, Accesensible and Pat,

I try the non-VBA solution first ( not too skilled in VBA yet).
 
I tried the inner join. That seems to give me the data I needed. Thanks again to both Pat and Accessensible.
 

Users who are viewing this thread

Back
Top Bottom