J
Jack Leach
Could someone please verify...
If I pass a form to a public function that has an argument of type Form
(byRef), using the Me keyword, there should be no chance that vba may get
confused if there happens to be two instances of that form opened, correct?
I'm trying to globalize some standard form operations.
The function:
Public Function GoToFormRecord(ByRef frm As Form, _
ByVal fld As String, _
ByVal txt As String _
) As Boolean
....
....
Set rs = frm.RecordsetClone
strCriteria = "[" & fld & "] = """ & txt & """"
rs.FindFirst strCriteria
If Not rs.NoMatch Then
frm.Bookmark = rs.Bookmark
Ret = True
Else
Ret = False
End If
....
....
End Function
and the caller:
Private Sub hbtnGo_Click()
If Not GoToRecord(Me, "fldCompanyCode", Me.hctlGo.Text) Then
MsgBox "Record Not Found"
End If
End Sub
I'm pretty sure Me passes the hwnd, and hoping that ByRef will take care of
any issues I might have with it even if it doesn't, but was hoping someone
can confirm this.
Thanks,
--
Jack Leach
www.tristatemachine.com
"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
If I pass a form to a public function that has an argument of type Form
(byRef), using the Me keyword, there should be no chance that vba may get
confused if there happens to be two instances of that form opened, correct?
I'm trying to globalize some standard form operations.
The function:
Public Function GoToFormRecord(ByRef frm As Form, _
ByVal fld As String, _
ByVal txt As String _
) As Boolean
....
....
Set rs = frm.RecordsetClone
strCriteria = "[" & fld & "] = """ & txt & """"
rs.FindFirst strCriteria
If Not rs.NoMatch Then
frm.Bookmark = rs.Bookmark
Ret = True
Else
Ret = False
End If
....
....
End Function
and the caller:
Private Sub hbtnGo_Click()
If Not GoToRecord(Me, "fldCompanyCode", Me.hctlGo.Text) Then
MsgBox "Record Not Found"
End If
End Sub
I'm pretty sure Me passes the hwnd, and hoping that ByRef will take care of
any issues I might have with it even if it doesn't, but was hoping someone
can confirm this.
Thanks,
--
Jack Leach
www.tristatemachine.com
"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)