P
Patrick Graham
I have function:
Sub PullRec(subfrm As Form, lbxMatchClmn As Variant,
varMatch As String)
Dim rs As Object
Set rs = subfrm.Recordset.Clone
If IsNumeric(lbxMatchClmn) Then
rs.FindFirst "[" & varMatch & "] = " & lbxMatchClmn
Else
rs.FindFirst "[" & varMatch & "] = '" & lbxMatchClmn & "'"
End If
If Not rs.EOF Then subfrm.Bookmark = rs.Bookmark
rs.Close
End Sub
Which I use to pull records for a subform using a List
Box selection which exists on the main form.
The function works fine at home but not at the office
(both use XP Access) and I need to find out why.
Work gives me this error:
Compile error: Object library feature not supported.
The line of code that causes this is the call to function:
Call PullRec(Me![subAccount].Form,
Me.lbxClientAccountLkUp.Column(1), "AccountNumber")
It highlights the .Form part when the error pops up.
If I replace the function call with:
Dim rst As Object
Set rst = Me![subAccount].Form.Recordset.Clone
rst.FindFirst "[AccountNumber] = '" &
Me.lbxClientAccountLkUp.Column(1) & "'"
If Not rst.EOF Then Me![subAccount].Form.Bookmark =
rst.Bookmark
rst.Close
it works fine but I'ld rather use my function. The odd
thing is the function is used a couple times to populate
different subforms before this one. Any thoughts?
Sub PullRec(subfrm As Form, lbxMatchClmn As Variant,
varMatch As String)
Dim rs As Object
Set rs = subfrm.Recordset.Clone
If IsNumeric(lbxMatchClmn) Then
rs.FindFirst "[" & varMatch & "] = " & lbxMatchClmn
Else
rs.FindFirst "[" & varMatch & "] = '" & lbxMatchClmn & "'"
End If
If Not rs.EOF Then subfrm.Bookmark = rs.Bookmark
rs.Close
End Sub
Which I use to pull records for a subform using a List
Box selection which exists on the main form.
The function works fine at home but not at the office
(both use XP Access) and I need to find out why.
Work gives me this error:
Compile error: Object library feature not supported.
The line of code that causes this is the call to function:
Call PullRec(Me![subAccount].Form,
Me.lbxClientAccountLkUp.Column(1), "AccountNumber")
It highlights the .Form part when the error pops up.
If I replace the function call with:
Dim rst As Object
Set rst = Me![subAccount].Form.Recordset.Clone
rst.FindFirst "[AccountNumber] = '" &
Me.lbxClientAccountLkUp.Column(1) & "'"
If Not rst.EOF Then Me![subAccount].Form.Bookmark =
rst.Bookmark
rst.Close
it works fine but I'ld rather use my function. The odd
thing is the function is used a couple times to populate
different subforms before this one. Any thoughts?