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

Conditional append query?

Status
Not open for further replies.

PAULCALLAGHAN

Technical User
Sep 4, 2001
165
CA
Access 2000
I have created two append queries to the same master table.

The first query appends for actual labour records to the master table.

The second query is suppose to append for standard labour records of these actual labour records in this master table.

I can not create a single append query because of the structure of the labour records. Trust me on this one, unless someone is up for a real challenge.

The primary keys in both is the combination of shop order number and operation sequence. This is unique, trust me.

The master table has shop order num, oper seq, std runtime, actual runtime, et al. The first append query simply puts values in all the proper fields of the master table except the 'standard' value fields, these have zeroes.

Conversely I want the second append query to simply check if the record exists - shop order num and oper seq combination - then insert the amount into the standard value field of the master table. That's all.

If the record does not exist already then insert everything except an actual value, that is zeroes for the actual fields.

Can someone please help me to write the SQL for this second query?
 
Have a look at the UPDATE instruction (SQL).

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top