FindRecord action (#2007 Error)

GUIDO22

Registered User.
Local time
Today, 21:01
Joined
Nov 2, 2003
Messages
515
Hello All
I am having the following problem - I have just upgraded from 97 to 2007. Problem has only started occuring since the upgrade on the DoCmd call, any ideas why? Is mean to find the suppliers record for that which is selected in the list box.....

Private Sub lstSuppliers_Click()
If (lstSuppliers.ListIndex >= 0) Then
txtName.SetFocus
DoCmd.FindRecord lstSuppliers.ItemData(lstSuppliers.ListIndex), acEntire, True, acSearchAll, , acCurrent, True
End If
End Sub

Resulting error string : #2162 , A macro set to one of the current field's properties failed because of an error in a FindRecord action argument
 
It's hard to judge for me because i have MS Access 2002, but what caught my attention is the following expression:

Code:
lstSuppliers.ItemData(lstSuppliers.ListIndex)

This is unnecessarily complex. The ItemData property returns the data in the bound column for the specified row. So this expression is equivalent to ...

Code:
lstSuppliers

It's only useful to use the ItemData property when you refer to a row other than the selected one.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom