Finding absent records

cigs

New Member
Joined
Dec 8, 2002
Messages
23
Two tables: STOCK and PRODUCTION. Each have a list of serial numbers in a field.

Say Stock table has the discrete values A,B,C,D
Production table has the discrete values A,B,D,E... Notice there is no 'C'

What is the query I need to return 'C' from the Stock table? ie a record that is not present in the production table.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
There is actually a Wizard in Access that compares two tables to find missing information. When you go to New Query, you should be able to start the wizard. However, if you want to build this yourself, you would create a new query and bring in both tables. You will need to make a join relationship between the field in the Stock table with the field in the Production table that you want to compare against. Set the properties of the relationship as follows: Show all records from Stock and include only the records from Production that are matching (or whatever the exact wording is).

Now that you made the relationship between your two tables, you just set up your query to show both fields from both tables. If you run it right now, you will see that the field from the Stock table will show all the records of that field, and the Production field will only show matching records, otherwise it will be blank. Almost there....If you go back in to the design mode and enter IsNull in the Criteria field of the Production field and run the report again, you will see that your query now only shows the records from Stock where there are no matching fields in Production.

Again, the easiest thing is just to run through the "Unmatched" query wizard and then look at the query to see how the query is set up.
 
Upvote 0
Hi,

i've been trying to do this exactly as you have described however I'm still only getting records that are matching in both tables.

is there anything I'm missing?

Thanks,
Pete
 
Upvote 0
It works fine for me. Before I start the wizard, the two tables must have their primary keys related (at least mine does). So I go to the 'relationship' section and drag the primary key of one onto the key of the other so the a relationship line appears between them.
Then I start up the wizard and it does the job.

Regards

Cigs
 
Upvote 0

Forum statistics

Threads
1,221,683
Messages
6,161,264
Members
451,692
Latest member
jmaskin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top