RunCommand.OpenModule Error

kmclane

New Member
Joined
Apr 1, 2004
Messages
42
I have a good one, here is the code I am trying to run:
Code:
Dim MsgTxt As String, Response As Variant
If Not IsCompiled() Then
MsgTxt = "The program file is currently in an uncompiled state" & vbCrLf
MsgTxt = MsgTxt & "This can result in severe performance problems." & vbCrLf
MsgTxt = MsgTxt & "Would you like to compile the program file?"
    Response = MsgBox(MsgTxt, vbYesNo + vbQuestion, "Performance Check")
    If Response = vbYes Then
        'DoCmd.Echo False
        DoCmd.OpenModule (AddTMF)
        DoCmd.SelectObject acModule, AddTMF
        RunCommand (acCmdCompileAndSaveAllModules)
        RunCommand (acCmdCompactDatabase)
        RunCommand (acCmdRepairDatabase)
        DoCmd.Close acModule, AddTMF
        'DoCmd.Echo True
        MsgTxt = "The program file has been compiled."
            Response = MsgBox(MsgTxt, vbInformation, "Compile Completed Successfully")
    End If
End If

This is the error I get:

Run-time Error'2520':
The action or method requires a Module or Procedure Name Argument.

It goes on to say that I tried to use the openmodule action or method without providing a module name. When clicking Debug, it highlights the name of the module in the code! I have checked to see if the name is correct, it is. Running Access 97 on XP. Any suggestions?

EDIT: Also, instead of opening the code window, it runs the module?

Thanks, Ken.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
If AddTMF is the name of your module, then my guess is that it should be contained in double quotes.
 
Upvote 0

Forum statistics

Threads
1,221,687
Messages
6,161,287
Members
451,695
Latest member
Doug Mize 1024

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top