Results 1 to 9 of 9
  1. #1
    Join Date
    Feb 2009
    Posts
    28

    Unanswered: Macro to run Macros

    Hi All,
    I was wondering to know if there is a way to create a Macro to run other macros. I have a situation where I have 3 macros (M1,M2,M3) and M2 is dependent on M1 and M3 is dependent on M2. Can I create the Macro to do this automatically (refresh and run). I need to do this so that I can eliminate alias names in Access

  2. #2
    Join Date
    May 2005
    Posts
    1,191
    I don't know if/how you do it from another macro, but you can do it via code with
    DoCmd.RunMacro "MacroName1"
    DoCmd.RunMacro "MacroName2"
    ...
    Me.Geek = True

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Not to belabor the obvious, but have you tried to do this and had problems with it? You can run a Macro from a Macro, by selecting, under "Action" RunMacro. You name the Macro to be run, go to the nexr line under "Action" and repeat.
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Join Date
    Feb 2009
    Posts
    28
    Nick, Thanks for the response in my other thread...I created 3 subroutines like this in VBA(I only pasted 2 here). How do I run the entire module at once. Right now I have to run them one by one
    Last edited by kvkanuri; 03-04-09 at 16:50.

  5. #5
    Join Date
    May 2005
    Posts
    1,191
    in whatever event you want these to fire, do like:
    Code:
    call V1
    call V2
    ...
    You might want to explicitly declare the type of the procedure as well, so like:
    Private Sub V1()
    or
    Public Sub V1()
    depending on how you have it set up (you can do a help search on these key words to get an explanation if you need).
    Me.Geek = True

  6. #6
    Join Date
    Feb 2009
    Posts
    28
    Awesome Nick...you rock buddy...I am now able to run all the queries but one of them I have to run it separately, can you help me figure out why

    Here is the code (the error says Syntax error in from clause). The SQL runs well in SQL or in design view, but not in the module. Please help
    Last edited by kvkanuri; 03-04-09 at 16:49.

  7. #7
    Join Date
    May 2005
    Posts
    1,191
    Quote Originally Posted by kvkanuri
    dbo_position.PARENT_COMP_COUNTRY_NAME INTO [T Jason Query 2]" & _
    "FROM dbo_position" & _
    Should read
    Code:
    dbo_position.PARENT_COMP_COUNTRY_NAME INTO [T Jason Query 2] " & _
    "FROM dbo_position " & _
    Gotta watch those spaces at the end, I always miss 'em to, first thing I check. Else it reads as:
    dbo_position.PARENT_COMP_COUNTRY_NAME INTO [T Jason Query 2]FROM dbo_positionGROUP By...

    EDIT: Same for other clauses btw.
    Me.Geek = True

  8. #8
    Join Date
    Feb 2009
    Posts
    28
    Yayyy...got it dude. Thanks so much...I am removing my code for security purpose... Thanks once again

  9. #9
    Join Date
    Feb 2009
    Posts
    28
    Thanks again Nick you rock!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •