If you have generic routines you would like to be available to all forms, put
the code in a standard module and change the declaration from Private to
Public. Then in the event for the forms, call the procedure. Here is an
example from a module in my application named modFormOperations. I call if
from the form Current event
Call SetNavButtons(Me)
Sub SetNavButtons(ByRef frmSomeForm As Form)
On Error GoTo SetNavButtons_Error
With frmSomeForm
If .CurrentRecord = 1 Then
.cmdNextRec.Enabled = True
.cmdLastRec.Enabled = True
.cmdNextRec.SetFocus
.cmdFirstRec.Enabled = False
.cmdPreviousRec.Enabled = False
ElseIf .CurrentRecord = .Recordset.RecordCount Then
.cmdFirstRec.Enabled = True
.cmdPreviousRec.Enabled = True
.cmdPreviousRec.SetFocus
.cmdNextRec.Enabled = False
.cmdLastRec.Enabled = False
Else
.cmdFirstRec.Enabled = True
.cmdPreviousRec.Enabled = True
.cmdNextRec.Enabled = True
.cmdLastRec.Enabled = True
End If
End With
SetNavButtons_Exit:
On Error Resume Next
Exit Sub
SetNavButtons_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & _
") in procedure SetNavButtons of Module modFormOperations"
GoTo SetNavButtons_Exit
End Sub