Hi Folks,
I have a search option on my form that allows the user to search a table by either first name or last name. They double click in the list box on the name they want. I am using the exact same code in another one but it doesn't seem to work. The error message I get is " The Microsoft jet database engine doesn't recognise (the name I selected) as a valid field name or expression"
I think that the error is in the double click event in the code. This is as follows:
_____________________________
Private Sub SearchList_DblClick(Cancel As Integer)
On Error GoTo Err_SearchList_DblClick
Dim db As DAO.Database
Dim rst As DAO.Recordset
DoCmd.OpenForm "Priests"
Set rst = Forms![Priests].RecordsetClone
rst.FindFirst "[LastName] = " & Me.SearchList
Forms![Priests].Bookmark = rst.Bookmark
DoCmd.Close acForm, Me.Name
Exit_SearchList_DblClick:
Exit Sub
Err_SearchList_DblClick:
MsgBox Err.Description
Resume Exit_SearchList_DblClick
End Sub
______________________________
Any suggestions greatly appreciated.
Thanks,
COlin.
I have a search option on my form that allows the user to search a table by either first name or last name. They double click in the list box on the name they want. I am using the exact same code in another one but it doesn't seem to work. The error message I get is " The Microsoft jet database engine doesn't recognise (the name I selected) as a valid field name or expression"
I think that the error is in the double click event in the code. This is as follows:
_____________________________
Private Sub SearchList_DblClick(Cancel As Integer)
On Error GoTo Err_SearchList_DblClick
Dim db As DAO.Database
Dim rst As DAO.Recordset
DoCmd.OpenForm "Priests"
Set rst = Forms![Priests].RecordsetClone
rst.FindFirst "[LastName] = " & Me.SearchList
Forms![Priests].Bookmark = rst.Bookmark
DoCmd.Close acForm, Me.Name
Exit_SearchList_DblClick:
Exit Sub
Err_SearchList_DblClick:
MsgBox Err.Description
Resume Exit_SearchList_DblClick
End Sub
______________________________
Any suggestions greatly appreciated.
Thanks,
COlin.