I am having troulble searching for a record on a form. The form is a subform. The error is on the FindFirst. The message is as follows.
The Microsoft Jet database engine does not recognize 'Forms!frmSAIDEEMain!sfrmHRReq.Form!fldReqID' as a valid field name or expression.
Someone gave me the link http://www.mvps.org/access/forms/frm0031.htm but that did not help. I redid the program and the code is below. I am just trying to search for a record on a form.
Thanks ahead of time. I am getting frustrated at this.
Al
TPrivate Sub Find_Req_Click()
On Error GoTo Err_Find_Req_Click
Dim Criteria As String
Dim FindID As String
Dim MyRs As DAO.Recordset
Dim MyForm As Form
FindID = InputBox("Find Req ID")
Set MyForm = Screen.ActiveForm
Set MyRs = MyForm.RecordsetClone
MyRs.Bookmark = MyForm.Bookmark
'Criteria = "[fldReqID] = """ & FindID & """"
'Forms!frmCoverPage!subInspectForm.Form!FormsUsedID
Criteria = "Forms!frmSAIDEEMain!sfrmHRReq.Form!fldReqID = " & FindID
MsgBox Criteria
MyRs.FindFirst Criteria
MsgBox "after find"
If MyRs.NoMatch Then
MsgBox "Nomatch"
Else
MyForm.Bookmark = MyRs.Bookmark
End If
MyForm.Close
Set MyForm = Nothing
MyRs.Close
Set MyRs = Nothing
Exit_Find_Req_Click:
Exit Sub
Err_Find_Req_Click:
MsgBox Err.Description
Resume Exit_Find_Req_Click
End Sub