Need code to evaluate table and find specific records.

  • Thread starter Thread starter fdco
  • Start date Start date
F

fdco

Guest
I am trying a new format with my Order Details table.

What I am looking for is some code that will search the order
details table and see if an item exists in it. If it does I
want the values from another table to be added to that record.
If there is no record there I would like to append a record.
I know I need two queries, an update and an append query. I have
them done but I don't know how to write the VB that will search
the order details table and decide (and run) whatever query is
needed. Any code offered will be appreciated.

Thanks
 
You can actually do this with one query so you won't need to write any code. Write a new query using the sample I am posting as a guide.

UPDATE Table1 RIGHT JOIN Table2 ON Table1.key = Table2.key SET Table1.[key] = [table2].[key], Table1.data = [table2].[data];

This query updates any row in table1 for which there is a matching key in table2 and if there is no match in table1, a new row is appended.

I've only shown two fields being updated, you will need to add as many as there are in your table.
 

Users who are viewing this thread

Back
Top Bottom