Error in Access07 when running DoCmd.RunMacro "MyMacro.MacroSub" , 1

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • surferj
    New Member
    • Dec 2008
    • 11

    Error in Access07 when running DoCmd.RunMacro "MyMacro.MacroSub" , 1

    Hello,
    I am trying to run a macro in that was created in an earlier version of access but getting an error message when i try to run it in 2007. The error occurs on the DoCmd.RunMacro "M_Report2007.C onsumerMoSalesR " , 1 line. Below is the VB scripting and error message. not sure if i need to create individual macro modules to be able to complete the commands but any help is appreciated.

    ERROR:

    Run-time Error '2501':
    The RunMacro action was cancelled.
    (END) (DEBUG)

    CODE:

    Code:
    Private Sub Cancel_Click()
         DoCmd.Close
    End Sub
    Code:
     Private Sub Form_Open(Cancel As Integer)
    'If Not bInReportOpenEvent Then
       ' If we're not called from the report
       'MsgBox "For use from the Sales Goals Report only", vbOKOnly
       'Cancel = True
    'End If
    'Form_Open_Exit:
       'Exit Sub
    End Sub
    Code:
    Private Sub OK_Click()
        If (Eval("[Forms]![F_Sales_Month DialogC].[CMonthC] Is Null")) Then
            '  is MISSING !
            Beep
            MsgBox "Current Month Value is MISSING !      Please Enter...........", vbOKOnly, ""
            Exit Sub
        End If
        If (Eval("[Forms]![F_Sales_Month DialogC].[NMonthC] Is Null")) Then
            '  is MISSING !
            Beep
            MsgBox "Next Month Value is MISSING !      Please Enter...........", vbOKOnly, ""
            Exit Sub
        End If
        
       Me.Visible = False
       DoCmd.RunMacro "M_Report2007.ConsumerMoSalesR", 1
    End Sub
  • nico5038
    Recognized Expert Specialist
    • Nov 2006
    • 3080

    #2
    Hard to determine the cause as the macro is missing. Best to transform the macro into code to see where it goes wrong.

    Nic;o)

    Comment

    • missinglinq
      Recognized Expert Specialist
      • Nov 2006
      • 3533

      #3
      Is a submacro something new in Access 2007? I can find no reference to it in v2003.

      Welcome to Bytes!

      Linq ;0)>

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        Originally posted by surferj
        Hello,
        I am trying to run a macro in that was created in an earlier version of access but getting an error message when i try to run it in 2007. The error occurs on the DoCmd.RunMacro "M_Report2007.C onsumerMoSalesR " , 1 line. Below is the VB scripting and error message. not sure if i need to create individual macro modules to be able to complete the commands but any help is appreciated.

        ERROR:

        Run-time Error '2501':
        The RunMacro action was cancelled.
        (END) (DEBUG)

        CODE:

        Code:
        Private Sub Cancel_Click()
             DoCmd.Close
        End Sub
        Code:
         Private Sub Form_Open(Cancel As Integer)
        'If Not bInReportOpenEvent Then
           ' If we're not called from the report
           'MsgBox "For use from the Sales Goals Report only", vbOKOnly
           'Cancel = True
        'End If
        'Form_Open_Exit:
           'Exit Sub
        End Sub
        Code:
        Private Sub OK_Click()
            If (Eval("[Forms]![F_Sales_Month DialogC].[CMonthC] Is Null")) Then
                '  is MISSING !
                Beep
                MsgBox "Current Month Value is MISSING !      Please Enter...........", vbOKOnly, ""
                Exit Sub
            End If
            If (Eval("[Forms]![F_Sales_Month DialogC].[NMonthC] Is Null")) Then
                '  is MISSING !
                Beep
                MsgBox "Next Month Value is MISSING !      Please Enter...........", vbOKOnly, ""
                Exit Sub
            End If
            
           Me.Visible = False
           DoCmd.RunMacro "M_Report2007.ConsumerMoSalesR", 1
        End Sub
        What you are attempting to do is to Run a specific Macro within a Macro Group, namely execute the ConsumerMoSales R Macro within the M_Report2007 Group. Access 2007 still supports the concept of Macro Groups, but does the Group Macro still exist and is it named M_Report2007? Is the Macro within this Group still named ConsumerMoSales R? Remove the Macro ConsumerMoSales R from the Group, isolate it, and run it as an individual Macro, then see what happens.

        Comment

        • surferj
          New Member
          • Dec 2008
          • 11

          #5
          Originally posted by missinglinq
          Is a submacro something new in Access 2007? I can find no reference to it in v2003.

          Welcome to Bytes!

          Linq ;0)>
          Sorry - Macro within a Macro Group

          Comment

          • surferj
            New Member
            • Dec 2008
            • 11

            #6
            Originally posted by ADezii
            What you are attempting to do is to Run a specific Macro within a Macro Group, namely execute the ConsumerMoSales R Macro within the M_Report2007 Group. Access 2007 still supports the concept of Macro Groups, but does the Group Macro still exist and is it named M_Report2007? Is the Macro within this Group still named ConsumerMoSales R? Remove the Macro ConsumerMoSales R from the Group, isolate it, and run it as an individual Macro, then see what happens.
            M_Report2007 still exists and named accordingly. Also ConsumerMoSales R exists within the macro group. Macro functions normally in Access2003 but for some reason does execute in 2007

            Comment

            • ADezii
              Recognized Expert Expert
              • Apr 2006
              • 8834

              #7
              Originally posted by surferj
              M_Report2007 still exists and named accordingly. Also ConsumerMoSales R exists within the macro group. Macro functions normally in Access2003 but for some reason does execute in 2007
              Then, convert the Macro to VBA Code, and you should have no problem. How about posting exactly what the Macro does, so that we may be able to look into the matter more deeply?

              Comment

              • nico5038
                Recognized Expert Specialist
                • Nov 2006
                • 3080

                #8
                Hmm, I see a duplication of comments <LOL>

                Nic;o)
                (But ofcourse interested in the code)

                Comment

                Working...