My Assistant
![]() ![]() |
|
|
Apr 24 2008, 10:17 AM
Post
#1
|
|
|
UtterAccess Addict Posts: 184 From: Pennsylvania |
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 |
|
|
|
Apr 24 2008, 11:23 AM
Post
#2
|
|
|
UtterAccess VIP Posts: 8,472 From: Dunbar,Scotland |
Hi
Have you tried in your criteria row the following? Me!sfrmHRReq.Form.fldReqID Mike |
|
|
|
Apr 24 2008, 11:39 AM
Post
#3
|
|
|
Retired Moderator Posts: 37,716 From: The San Francisco Bay Area |
Also, is "sfrmHRReq" the name of the subform CONTROL and not the name of the subform itself? They are not always the same...
hth, Jack |
|
|
|
Apr 24 2008, 12:31 PM
Post
#4
|
|
|
UtterAccess Addict Posts: 184 From: Pennsylvania |
"sfrmHRReq" is the name of the subform.
I am going to try the other suggestion. Al |
|
|
|
Apr 24 2008, 12:35 PM
Post
#5
|
|
|
Retired Moderator Posts: 37,716 From: The San Francisco Bay Area |
The name of the subform and subform CONTROL may not be the same. Check the name of the subform control on your main form to be sure it is "sfmHRReq"... We may have semantics problem in that the name of the CONTROL may, in fact, be "sfmHRReq" and if it is then that is not the problem..
Jack |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 23rd May 2013 - 06:46 PM |