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

Search one table, update another if not found 1

Status
Not open for further replies.

drmoreland

IS-IT--Management
Jul 5, 2001
2
US
I would like to search for a customer order in a table of customer returns. If the order is not present, I would like to locate the order in another table ( customer orders) and then create a record in the customer returns table with specific fields from the customer orders table.

The road I was going down was to query customer returns and then on no results, query customer orders. I just can't seem to write the code to make that happen.

Any help would be appreciated.
 
Better and easier to just do an Update query. If the record is present in the dest, it is "refreshed", otherwise it is added. Then just find it in the dest table.



MichaelRed
mred@att.net

There is never time to do it right but there is always time to do it over
 
Thanks for you help Michael. I don't want to refresh however because I am updating with things not in the orig database.

What code can I use to run another query, if the first query finds no records?

Skip
 
Check the recordcount property of the first query. If it is Zero, no record(s) were found.

MichaelRed
mred@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top