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

UPDATE if exists, else INSERT new record

Status
Not open for further replies.

drewby1

Technical User
Jan 8, 2002
13
GB
Hi All

I have 2 tables (TABLEA and TABLEB). One is populated with data and has a unique field TABLEA.QMref. The other will hold extra data but will also have the same unique field TABLEB.QMref.

I want to insert a new record in TABLEB from a form frmDATA with several checkboxes (and a QMref, frmDATA.QMref) unless a record with frmDATA.QMref already exists. If the record exists I want to update TABLEB rather than insert.

I know I could do this with several SQL queries but I was wonderng if there was a more efficient way to do this?

p.s. I can't add the fields into TABLEA as this is a linked table I canot amend.

Any ideas would be much appreciated, thanks in advance
 
Update will append (new) if a record does not already exist.


Read the docs (help) CAREFULLY and experiment (hopefully with a Test db).

MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
thanks michael

how ridiculously easy the answer was! red faced but happy. will try as there's no data in the 2nd table so nothing to mess up (yet!)

Many thanks

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top