View Full Version : Run Macro in VBA help


AnnPhil
04-01-2008, 04:45 PM
Hopefully this is a simple fix for someone who runs macros in access modules.

I have code tied to a Print button that prints a different report based on which one the user selects, one of them needs a macro to run in order to generate report so i wrote this line of code for the one that needed a macro to run.

DoCmd.RunMacro SpendingReportsMacro_County

It runs the macro fine but then an error message comes up on the screen that says "The action or method requires a Macro Name argument"

Why does this message come up? What am i missing here?

Thanks for any help

ajetrumpet
04-01-2008, 07:47 PM
what is the syntax for the docmd.runmacro command? Have you filled in all the required sections of it? Does the macro name need to be enclose in quotes to indicate a string?

Mike375
04-01-2008, 08:10 PM
Adam,

You had it right.

DoCmd.RunMacro "Macro340", , ""

That is a copy and paste for one of mine.

ajetrumpet
04-01-2008, 08:17 PM
Great!! Hopefully they can correct it then. :)