Link to home
Start Free TrialLog in
Avatar of schneider_ks
schneider_ks

asked on

update query two identical tables one to one relationship

HELP! I'm trying to restore data that was inadvertently deleted from a table with data from a backup table. I need to update the fields in tblBooks1 with the data in the fields in tblBooksonly284 for all records in tblBooksonly284.

I tried this query, but am getting pop-ups that are asking for parameter values for all tblBooksonly284 fields.

I tried earlier but negleted to add the WHERE clause, and it deleted ALL data from all of these fields,  I had backed up the data, so am trying again.

What am I doing wrong?  
The identical field is an autonumber field.  Hopefully it's possible to join those fields.

UPDATE tblBooks1 SET tblBooks1.YrWritten = tblBooksonly284!YrWritten, tblBooks1.NoPages = tblBooksonly284!NoPages, tblBooks1.Summary = tblBooksonly284!Summary, tblBooks1.GenreID = tblBooksonly284!GenreID, tblBooks1.[Film Title] = tblBooksonly284!FilmTitle, tblBooks1.FilmDate = tblBooksonly284!FilmDate, tblBooks1.FilmDetails = tblBooksonly284!FilmDetails, tblBooks1.Subjects = tblBooksonly284!Subjects
WHERE tblBooks1.BookID  = tblBooksonly284.BookID;

Thanks.
Avatar of schneider_ks
schneider_ks

ASKER

PS, I should add that the tblBooks1 has 1200 records, and the tblBooksonly284 has only 284 records.  The rest of the records were inadvertently deleted.
ASKER CERTIFIED SOLUTION
Avatar of Paulstott
Paulstott

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
or:

UPDATE tblBooks1,tblBooksonly284  SET tblBooks1.YrWritten = tblBooksonly284!YrWritten, tblBooks1.NoPages = tblBooksonly284!NoPages, tblBooks1.Summary = tblBooksonly284!Summary, tblBooks1.GenreID = tblBooksonly284!GenreID, tblBooks1.[Film Title] = tblBooksonly284!FilmTitle, tblBooks1.FilmDate = tblBooksonly284!FilmDate, tblBooks1.FilmDetails = tblBooksonly284!FilmDetails, tblBooks1.Subjects = tblBooksonly284!Subjects
WHERE tblBooks1.BookID  = tblBooksonly284.BookID;


AW
Excellent.  Problem Solved.  Thanks for the quick fix