Create a custom function
- Open a new module.
- To open a new standard module, in the Database window, click Modules under Objects, and then click the New button 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 under Objects, select the module you want to open, and then click the Design button on the Database window toolbar.
- Declare the function by typing the Function statement.
- Type a function name immediately followed by any function arguments in parentheses. For example, the following declaration for the IsLoaded function specifies strFormName as an argument:
Function IsLoaded(strFormName As String) As Boolean
- Add the Visual Basic code that performs the operation or calculation that you want the function to perform.
For more information on the Function statement, click .