One approach is to declare the recordset object variable in module header then the object is available to multiple procedures.
This example is code behind a form so the recordset object is available only to procedures behind that form. However, it does not repeatedly run the query.
Code:
Option Compare Database
Option Explicit
Public strOldLabNum
Dim cn As ADODB.Connection
Dim rsOldSample As ADODB.Recordset
Private Sub cbxOldLabNum_AfterUpdate()
Dim strPV As String
Set cn = CurrentProject.Connection
Set rsOldSample = New ADODB.Recordset
...
rsOldSample.Open "SELECT zSampleInformation.* " & _
"FROM zSampleInformation WHERE LabNum='" & strOldLabNum & "';", cn, adOpenStatic, adLockPessimistic
...
End Sub
Function Transfer() As String
...
If rsOldSample!Metric <> IIf([lbxProjectRecord].[Column](5) = 0, False, True) Then
...
End Function
Declare the recordset object in a general module and it will be available from anywhere. Have to be sure to close the recordset object before opening it again.