Create a custom Sub procedure
- Open a new module.
- To open a new standard module, in the Database window, click Modules under Objects, and then click New on the Database window toolbar. To open an existing standard module, click Modules under Objects, select the module you want to open, and then click Design.
- To open a form module or report module, open the form or report in Design view, and then click Code on the toolbar.
- To open a new class module that isn't associated with a form or report, in the Database window click Class Module on the Insert menu. To open an existing class module, in the Database window, click Modules , select the module you want to open, and then click Design on the Database window toolbar.
- Declare the procedure by typing the Sub statement.
- Type a procedure name, immediately followed by any arguments in parentheses. For example, the following declaration for the ShowEvent Sub procedure specifies (EventName As String) as an argument:
Sub ShowEvent(EventName As String)
- Add the Visual Basic code that performs the operation that you want the procedure to perform.
For more information on the Sub statement, click .