Log in

View Full Version : Need help automating an Access macro.



dmc183
01-04-2010, 07:15 AM
I have a macro setup in Access that runs several queries against an OBDC data source, then compiles them into a comma delimited file. The script below works fine for that purpose. However, it still requires manual input of the user credentials to access the information I need before the queries will run. Is there a way to include my user information in this script to fully automate the process? Apologies, I'm new to scripting as you can probably tell by how simple this is. Any help would be appreciated, thanks!


Const DBPath = "C:\CONTACTS\DMT.mdb"
Const MacroName = "BCL"

Set AccessApp = GetObject(DBPath, "Access.Application")
AccessApp.DoCmd.RunMacro MacroName
AccessApp.Quit

CreganTur
01-05-2010, 06:34 AM
The only answer I can think of is to stop using Macros and start using VBA. With the programing language you can have much more control than a macro could ever achieve.