By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,701 Members | 1,938 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,701 IT Pros & Developers. It's quick & easy.

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

P: 11
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.ConsumerMoSalesR" , 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:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Cancel_Click()
  2.      DoCmd.Close
  3. End Sub
Expand|Select|Wrap|Line Numbers
  1.  Private Sub Form_Open(Cancel As Integer)
  2. 'If Not bInReportOpenEvent Then
  3.    ' If we're not called from the report
  4.    'MsgBox "For use from the Sales Goals Report only", vbOKOnly
  5.    'Cancel = True
  6. 'End If
  7. 'Form_Open_Exit:
  8.    'Exit Sub
  9. End Sub
Expand|Select|Wrap|Line Numbers
  1. Private Sub OK_Click()
  2.     If (Eval("[Forms]![F_Sales_Month DialogC].[CMonthC] Is Null")) Then
  3.         '  is MISSING !
  4.         Beep
  5.         MsgBox "Current Month Value is MISSING !      Please Enter...........", vbOKOnly, ""
  6.         Exit Sub
  7.     End If
  8.     If (Eval("[Forms]![F_Sales_Month DialogC].[NMonthC] Is Null")) Then
  9.         '  is MISSING !
  10.         Beep
  11.         MsgBox "Next Month Value is MISSING !      Please Enter...........", vbOKOnly, ""
  12.         Exit Sub
  13.     End If
  14.  
  15.    Me.Visible = False
  16.    DoCmd.RunMacro "M_Report2007.ConsumerMoSalesR", 1
  17. End Sub
Dec 25 '08 #1
Share this Question
Share on Google+
7 Replies


nico5038
Expert 2.5K+
P: 3,072
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)
Dec 25 '08 #2

missinglinq
Expert 2.5K+
P: 3,532
Is a submacro something new in Access 2007? I can find no reference to it in v2003.

Welcome to Bytes!

Linq ;0)>
Dec 25 '08 #3

ADezii
Expert 5K+
P: 8,634
@surferj
What you are attempting to do is to Run a specific Macro within a Macro Group, namely execute the ConsumerMoSalesR 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 ConsumerMoSalesR? Remove the Macro ConsumerMoSalesR from the Group, isolate it, and run it as an individual Macro, then see what happens.
Dec 25 '08 #4

P: 11
@missinglinq
Sorry - Macro within a Macro Group
Dec 27 '08 #5

P: 11
@ADezii
M_Report2007 still exists and named accordingly. Also ConsumerMoSalesR exists within the macro group. Macro functions normally in Access2003 but for some reason does execute in 2007
Dec 27 '08 #6

ADezii
Expert 5K+
P: 8,634
@surferj
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?
Dec 27 '08 #7

nico5038
Expert 2.5K+
P: 3,072
Hmm, I see a duplication of comments <LOL>

Nic;o)
(But ofcourse interested in the code)
Dec 27 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.