Macro to run Other Macros (Conditional) (1 Viewer)

VMoney

New member
Local time
Today, 11:38
Joined
Aug 9, 2013
Messages
1
Hello,
This may be a bit complicated, so please let me know if I am taking the correct route to accomplish this.....basically I have an Access Database with a main menu form that has a dropdown box to allow the user to make a selection which stores into a field in a table. Based on the data in the field (there are only 4 possible selections), I would want to trigger a macro I created to run a report (I have a separate macro created for each of the 4 reports as well). I started creating a module and have tried the following code which is obviously erroneous, but you may be able to better understand where I am going with this is I share it:


Sub
If strField = "Line Selection" strTable = "Main Menu Line Selection"
Main Menu Line Selection.Line Selection = HT6
Then DoCmd.RunMacro "Run HT6_AGGREGATE Report"

ElseIf strField = "Line Selection" strTable = "Main Menu Line Selection"
Main Menu Line Selection.Line Selection = HT8
Then DoCmd.RunMacro "Run HT8_AGGREGATE Report"

ElseIf strField = "Line Selection" strTable = "Main Menu Line Selection"
Main Menu Line Selection.Line Selection = HTFL
Then DoCmd.RunMacro "Run HTFL_AGGREGATE Report"

ElseIf strField = "Line Selection" strTable = "Main Menu Line Selection"
Main Menu Line Selection.Line Selection = SDFL
Then DoCmd.RunMacro "Run SDFL_AGGREGATE Report"
End If

End Sub
 

noboffinme

Registered User.
Local time
Tomorrow, 02:38
Joined
Nov 28, 2007
Messages
288
Hi VMoney,

Can you advise the version of Office this was created in & where you get the error & what the error is?

Just to confirm, you want the user to open a Form that has a Combo Box Drop Down Menu with these 4 items.

As they click on one of the items in the selection, that report is run, is that correct?

Please advise the above & confirm, Cheers
 

noboffinme

Registered User.
Local time
Tomorrow, 02:38
Joined
Nov 28, 2007
Messages
288
Hi Again,

Here's a quick mockup for what I think you're after.

Let me know if this is what you wanted. Cheers
 

Attachments

  • Click_Reports.zip
    72.2 KB · Views: 112

Users who are viewing this thread

Top Bottom