KK wrote:
As I need to run these series of queries few times (In different
environments and later on to the production environment) do I need to
create any functions or GUI to execute the scripts.. I am basically not
a hardcore VBA developer..
Is there any code available to pass the series of queries as parameters
Why do you need to pass parameters?
*One* (and certainly not the only) way to do it:
1. create an unbound form with a button and a label.
2. in the button's click event, do something like
- set the label's text to "Processing <queryname>..."
- run the query (DoCmd.OpenQuery "queryname")
- do this for each query and use the DoEvents and Me.Repaint to
repaint the form (so you see the updated messages).
- SHow the done message. Then hide the label.
you might want to use DoCmd.Execute "SQL Statement..." and then you
won't get lots of annoying "are you sure?" garbage, but you do want
error messages to get returned so you know what's going on.... (I guess
you could create a function to run the query and return the error # to
the function result... If it's zero, then everything's fine.
Have a look around the NG for RunSQL, OpenQuery, and DoCmd.Execute {SQL
Statement]
That should give you a place to start. But I'd make backups before
doing lots of data manipulation. You may not get it right the first
few tries. so just leave yourself an escape route (yes, you could use a
transaction, but get the basics going first...)
Hope this helps a little.
Pieter