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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

not already in database check 1

Status
Not open for further replies.

koresnordic

IS-IT--Management
Joined
Nov 28, 2002
Messages
422
Location
GB
Can people help? I have a table that contains purchase order numbers. These are numbers that have already printed on a report. I do not want these to appear again. I need to update this list with a new set of numbers (held in a seperate table - because the data is held on another server linked to this database). But if the number already exists, i do not want to put it going in again. I am running Access 2002. [pc]

Graham
 
You want something like this..

"INSERT INTO tblName (Name) SELECT Name FROM tblNameTwo WHERE tblNameTwo.Name NOT IN (SELECT Name FROM tblName)"

This would insert all Name from tblNameTwo into tblName where tblNameTwo.Name is not in Name in tblName...

Er... sounds confusing but hopefully you get the idea??
There are two ways to write error-free programs; only the third one works.
 
Thanks for that. But I am not really that good at Access. Is this in a module, macro, query? I tried placing it into a module and I get an error on the first table name - expected end of statement. [pc]

Graham
 
You can use this as the SQL for a query.

There are two ways to write error-free programs; only the third one works.
 
Worked perfectly. Thanks for that. Didn't even realise I could enter sql into a query! I did say I wasn't good with Access. [pc]

Graham
 
You live and learn !!

[2thumbsup] There are two ways to write error-free programs; only the third one works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top