Using a query to add a flag from one table to another

  • Thread starter Thread starter Raman325
  • Start date Start date
R

Raman325

Guest
Using a query to compare two linked tables

Hi, just so you are aware, I am totally clueless when it comes to Microsoft Access. I tried finding tutorials and help online that I could use to do this but I'm having trouble understanding what I'm supposed to do. I have two huge tables linked to each other by an ID number. One table contains multiple records with the same ID number while the other does not. There are records in the first table that don't appear in the second one, and there MAY be entries in the second table that don't appear in the first table. The second table has a flag that I would like to add to records in the first table that appear in the second table. What is the easiestt way to do this? This may be an extremely stupid question or it may be very hard, I'm not sure which, though I'm leaning toward it being a stupid question. Thank you in advance for your help.
 
Last edited:
Just so I understand.
The table that currently contains the flag, does it have multiple records with the same ID, or is it the table with single ID's?
 
It's the table with the single IDs. I posted this on another forum and I think the person who replied was confused with what I wanted to do so here is a simpler way to do it. I would like to remove all duplicate entries from the first table then make a new table which contains the records from the first query that are not in the second table. I hope that helps
 
You can update all the rows with the flag in your second table with the flag from the first table without deleting rows. The easist way is to use the query grid. Add both tables (add the one without the flag first) Drag the ID in the second table to the matching ID column in the first table (it should draw a line between them JOINING the tables on the ID field). Click QUERY, UPDATE from the menu. Drag and drop the field from the table you want to UPDATE (put the flag in) to the query. In the UPDATE TO column key in the table name that contains the flag, period, flag column name (TBL2.FLAGCOL) but no parens. Save the query. Run the query. This will update the flag field in the first table where all the ID's match the second table.
 
Right, I don't know why I didnt do that sooner. I was given a 5 minute crash course in access last week and that was the first thing I was taught how to do but as soon as I actually had to do it on my own I had no idea what I was doing. I appreciate it FoFa, thanks!
 

Users who are viewing this thread

Back
Top Bottom