Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete records based on values from another table 1

Status
Not open for further replies.

nissan240zx

Programmer
Jun 26, 2005
280
US
Hello All,
This might a simple question but I need help.
Ok. I got 2 tables

Table 1 has over 4000 records and is the main/master table.
Its got say 50 fields.

Table 2 is a dummy table created for temporary purpose,which has 2 fields.
I call it Field1 and Field2. These 2 fields match with 2 fields from Table 1 (Field3 and Field4).

Now what I want to do is..delete all records in Table1 that match Field1 & Field2 from Table2.

Please help.

Nissan 240 ZX...best Nissan Ever
 
Try set the Primary Key of the dummy table to the two fields. You should then be able to join this table in a delete query with your Table1.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
The table wont allow me to pick 2 primary keeps in the design mode.
Can I use any SQL to fix this issue.
Thanks

Nissan 240 ZX...best Nissan Ever
 
In design view, select both fields (ctrl + click), then either hit the PK button on the toolbar, or right click OUTSIDE the "field selectors" but within one of the selected fields.

Roy-Vidar
 
You should be able to select the two fields and click the key symbol/icon.

BTW: I have some great memories of a 1974(?) road trip from Mpls, Minn. to a rugby tournament in Park City, Utah in a "Datsun 240z". Some of the trip I don't recall either due to current old age or past consumption!

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Hello Duane,
I got it working with a left join. Thanks for the tip.

I got my 240ZX from my father in law. Got it completly restored with all the good tuned parts (Thanks to Ebay)




Nissan 240 ZX...best Nissan Ever
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top