Trigger a module from VBA

Anonymous
2016-09-15T23:30:57+00:00

I have the below module called 'OpenMeetingArchivesFolder" .

In a form I have a button with a click event "Private Sub btn_SaveFile_Click()" code. At the end of its code I would like to activate the below module which opens a folder.

I tried this, and it opens the folder but it gives me an error

DoCmd.OpenModule OpenMeetingArchivesFolder, openPaTH()

Option Compare Database

Public Function openPaTH()

Dim strPath As String

strPath = CurrentProject.Path & "\Meeting Agenda Archives"

If Len(Dir(strPath)) > 0 Then Shell "explorer.exe " & strPath, vbNormalFocus

End Function

How do i trigger a module from VBA?

Iram/mcp

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes
Answer accepted by question author
  1. Anonymous
    2016-09-16T00:20:06+00:00

    A Module is just a container for one or more Sub, Function or other procedures. You don't open the container - you call the Sub with something like

    Call MySubName(arguments)

    or execute the function by setting a variable to the function's returned value:

    Dim strNewPath As String

    strNewpath = openPAtH()

    <do something with the path value>

    0 comments No comments

0 additional answers

Sort by: Most helpful