I am working with an ancient software package that is not very well designed (not even close to being normalized). All the data is held in DBF files.
I need to recreate some reporting that we have using Access. The reporting is a bit complex, so I am trying to make it as efficient as possible, so as not to bog down the process too much.
Here is the current situation.
There is a table that lists a Company ID and then twenty different possible "plan" fields (let's call it Table1).
There is another table that lists all the "plans" that the company actually has (let's call that Table2).
I need to find all the Codes in Table 2 that do not appear in Table 1.
Here is an example of Table1 (header row and one data record):
Code:
CO ID PR1 PR2 PR3 PR4 PR5 PR6 PR7 PR8 PR9 PR10 PT1 PT2 PT3 PT4 PT5 PT6 PT7 PT8 PT9 PT10
ABC123 AB AD AZ DX DZ RM NS NZ FB FD
Here is an example of Table2 (header row and 13 data records):
Code:
CODES
AB
AC
AD
AZ
DX
DZ
FB
FC
FD
NS
NZ
RM
RN
So, in my query, I should return three records, AC, FC, and RN.
If the Table1 was normalized, this would be very easy (an Unmatched Query). Now, I could use record sets and VBA and loop through Table1 to create a new temporary table (which is normalized), and use that in an Unmatched Query. But I was wondering (and hoping) if there is a more efficient way to simply use dynamic queries without any need for temporary tables.
Any ideas?