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

Run one query following completion of another 1

Status
Not open for further replies.

Loomah

Technical User
Mar 4, 2002
1,911
IE
Hi
I'm no Access expert so please bear with me on this!

I have a create table query that merges data from 5 other tables into a single source.

I now need to update the new table (I have the update query) immediately after it is created. The update data doesn't fit nicely into any of the original tables prior to the merging of the data otherwise that would be nice and simple!

My question is can I capture an event of some kind when the make table query finishes so that I can then run/open the update query automatically. I need to do this to eliminate the possibility that I forget to run the update to the new table.

I have absolutely no experience of Access VBA (only Excel and a little Word) and minimal experience of Access all round. So any simple pointers to put me in the right direction would be appreciated.

;-)
If a man says something and there are no women there to hear him, is he still wrong? [ponder]
How do I get the best answers?
 
How are you running the make table query? From a form, or by hand? There is no event associated with a stand alone query. It would have to be a form event that controls this.

Paul
 
Macros are ideal for this. Create a macro. Enter the two queries in the space provided then just run the macro everytime instead of the individual queries.

People don't like macros on this channel but VBA is a pain until you get used to the geeky IDE.

 
Paul
Thanks for the input - it's a stand alsone, run by hand query (this isn't a database app - just a means of storing and merging data). Useful pointers for me for the future!

BNPMike
This is causing me so much pain from kicking myself! For my purposes this is the ideal solution and I was actually halfway there - hence the kicking! Thanks

;-)
If a man says something and there are no women there to hear him, is he still wrong? [ponder]
How do I get the best answers?
 
This is one of my pet peeves also... I would like to be able to 'chain' SQL statements so that a single query can perform multiple statements.

I do not know of a way to do this in Access (SQL server is happy to do it OTOH).

Macros is the 'official' way to do it.

The alternative is the way I do it... I name the queries as follows;

1 - Merge Data
2 - Update Table

and then I simply execute them manually in order. It's a pain, but it does mean that I can deal with problems when they happen... the second query may be run by the macro because it thinks the first worked even though the results were wrong (for example if it accidentally deleted all the rows).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top