Application.Run (Access)
You can use the Run method to carry out a specified Microsoft Access or user-defined Function or Sub procedure.
This method is useful when you are controlling Microsoft Access from another application through Automation, formerly called OLE Automation. For example, you can use the Run method from an ActiveX component to carry out a Sub procedure that is defined within an Access database. You can set a reference to the Access type library from any other ActiveX component and use the objects, methods, and properties defined in that library in your code. However, you can't set a reference to an individual Access database from any application other than Access. For example, suppose you have defined a procedure named NewForm in a database with its ProjectName property set to "WizCode." The NewForm procedure takes a string argument. You can call NewForm in the following manner from Visual Basic:
Run (Procedure, Arg1, ..., Arg30)
Dim appAccess As New Access.Application
appAccess.OpenCurrentDatabase ("C:\My Documents\WizCode.mdb")
appAccess.Run "WizCode.NewForm", "Some String"
Arguments
Procedure, Arg1, ..., Arg31The following argument is required
Procedure (String) - The name of the Function or Sub procedure to be run. If you are calling a procedure in another database, use the project name and the procedure name separated by a dot in the form: "projectname.procedurename" If you execute Visual Basic code containing the Run method in a library database, Access looks for the procedure first in the library database, and then in the current database.