View Single Post
  #14  
Old December 22nd, 2008, 03:11 PM posted to microsoft.public.access.gettingstarted
Steve[_57_]
external usenet poster
 
Posts: 598
Default delete records from one table if not in another

Is your problem solved then?

Steve


"mcnews" wrote in message
...
On Dec 21, 5:32 pm, "Steve" wrote:
1. When you go to New - Unmatched Query to start the wizard, do you get a
listbox with all your tables?

2. You need to select the Backup table first and then the original table.
Then do you get two listboxes where the left listbox shows the fields in
the
backup table and the right list box shows the fields in the original
table?

Steve

"mcnewsxp" wrote in message

...



"Steve" wrote in message
om...
Are you talking about the wizard and the two listboxes for selecting
fields to match?


yes


"mcnewsxp" wrote in message
...


"Steve" wrote in message
news:x7mdnajbA5oxPNfUnZ2dnUVZ_gGdnZ2d@earthlink .com...
If you make a backup of the original table and then import new
records
into the backup table, the new records will not be in the original
table. Your unmatched query should look at the backup table to find
records that are not in the original table. If you do not return any
records, are you specifying an appropriate field in the unmatched
query?


I am a bit puzzeled by your response "....no fields show up in the
list...." By "fields" do you mean records or do you truly mean
fields?
Please clarify.


when i go to create the unmatched query after selecting the two
tables -
on the form where you select the fields to match theres nothing in the
lists...?


"mcnewsxp" wrote in message
.. .


"Steve" wrote in message
...
Try creating an unmatched query and changing it to a delete query.
There's a wixard for creating an unmatched query by going to
queries
in the database window and clicking new.


good idea.
except when i do this no fields show up in the list....???


"mcnewsxp" wrote in message
.. .
how can i delete records from one table if the records do not
exist
in a matching table? i am making a backup of a table before an
import is performed. the users may need to undo the backup so i
need to be able to delete only the new records. this is not
working,
but you get the idea:


DELETE tblPatient.* FROM tblPatient INNER JOIN tblPatientBackup ON
tblPatient.PatientID = tblPatientBackup.PatientID
WHERE tblPatient.PatientID tblPatientBackup.PatientID;


tia,
mcnewxp


i tried it on my work PC and it works fine.....