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

Macro question

Status
Not open for further replies.

shannonlp

Technical User
Feb 9, 2006
163
US
I am new to Access and have never worked with macros. I’m trying to create a macro that will do the following (I’ve outlined the steps the macro should execute):

1. Delete the rows in an existing table with the database (Customer_Master)
2. Run query 1
3. Write the results of query 1 to the Customer_Master table
4. Run query 2
5. Write the results of query 1 to the Customer_Master table – do not write over existing data from query 1
6. Run a select distinct query on the Customer_Master table

Is this achievable using a macro? This is for a data cleanup exercise where we get extracts from different systems. I’m trying to automate this process using macros.

So far it looks like OpenTable should be the first action. I can’t find the action for deleting the rows in a table. I also see that one of the steps should be OpenQuery but I can’t find how to send the results to an existing table.

Any help would be greatly appreciated.

Thanks,
Shannon
 
I would suggest checking into using vba for this rather than a macro.

Run a delete query
Run query1 as an Append query
Run query2 as an Append query
Run query3 as a Select query

Can queries 1 & 2 be combined? Or, can you run your select query directly?

As far as automating this process, you can have the vba run on a button click or even on a form open/load or close/unload. You have many options - how you proceed depends on your current database structure.

Let them hate - so long as they fear... Lucius Accius
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top