Search code examples
ms-accessvbams-access-2007ms-access-2010

cannot find name when running AutoExec macro


In Access I created a Function within a Module.

I need to execute this module when the Access application first opens.

In the AutoExec macro, I added the action [RunCode] and wrote the name of the function from this module in [Function Name] but when I run the application I am getting the following error: access error msg


Solution

  • If you're using a function, you should always include a set of parenthesis at the end:

    DsnLessLinkTable()
    

    This is the proper way to reference a function, and becomes important if you are ever passing variables to a function, so it's good practice to always use that syntax.