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

runn a macro automatically when accessing a query?

Status
Not open for further replies.

lieip

Programmer
Oct 2, 2001
12
US
How do I call run a macro as soon as I access a query?
I'm creating a database in access and also creating a web interface... now my problem is that i need to run a macro when i access a query that i've already defined in the Access database.. how can i do that without having to create a button with code behind it to run the macro.

any help would be greatly appreciated!
 
It depends on how you launch the query. If you're using the Access interface to launch the query then that's the end of the command string. If the query is triggered by loading of a form such as its being used as a data source for a combo box, then you can try the On Open event. The easiest way is to launch the query from code where you can chain the macro trigger, i.e.

DoCmd.OpenQuery "QueryName"
DoCmd.RunMacro "MacroName"

Uncle Jack
 
I'm using the web as an interface... I'm coding the interface using vbscript/javascript.. is there a simular cnd that does the Do.Cmd in vbscript or javascript or any kind of language that i can use to program within an ASP page?
 
Sorry, I haven't a clue; I do Access only.


Uncle Jack
 
If you can run the query using....whatever programming language you're using, shouldn't you also be able to run the macro? So, run the macro first then the Query.

If you can't run the macro like that, how about VBA code? As far as I can tell, Macros seem to be a quick way of setting up VBA code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top