Trying to automate form in Access

drew23

New member
Local time
Yesterday, 18:16
Joined
May 19, 2009
Messages
6
Hi everyone

I have a excel spreadsheet that imports files from several locations and drives and saves them all in one location. Then I have an Access database that has a macro in a form that imports all these files into the database and into the appropriate tables.
What I want to do is automate the step between excel and access. All i need is a code for excel to say click on this button in the form.
I have tried several things i.e application.run "macroname" but nothing seems to work.
Is there some kind of special referencing I need to do.

Any helps much appreciated.

Thanks in advance

Drew23
 
On the OnClick() of the button you need the following


DoCmd.RunMacro "MacroName"
 
Thanks DCrake

Tried that and i get run-time error message 2486
Application-defined or object defined error.

This is the code i use. the line in red is the one that fails.

Thanks

'to open dtb
Set oApp = CreateObject("Access.Application")
oApp.Visible = True
oApp.OpenCurrentDatabase database

'to run button on form
Set db = CurrentDb
DoCmd.RunMacro "update"
 

Users who are viewing this thread

Back
Top Bottom