Sub ChangeCaption(frmAny as Form) 'Change the caption property of the form received 'to what was already in the caption property, 'concatenated with a colon and the name of the current user frmAny.Caption = frmAny.Caption & ": " & CurrentUser End Sub
The ChangeCaption routine receives a reference to a form as a parameter. The caption of the form referenced by the procedure is modified to include the name of the current user. The ChangeCaption routine is called like this:
Private Sub cmdChangeCaption_Click() 'Call the ChangeCaption routine, passing a reference to the current form Call ChangeCaption(Me) End Sub
In this example, the click event of the cmdChangeCaption command button calls the ChangeCaption routine, sending a reference to the form that the command button is contained within. You will find this code in the form frmChangeCaption.