-
Find button to search subform
Hey All,
I am trying to make a button in the main form that will search the subform. Here is what I have:
Private Sub Find_Click()
Dim strFindRecord As String
strFindRecord = InputBox("Enter a name to find", "Enter Name")
DoCmd.GoToControl ("ctlPart_Number")
DoCmd.FindRecord strFindRecord
End Sub
It works if ctlPart_Number is in the main form, but not if it is in the subform. How do I get it to work?
-
mwork, you need to refer to the Subform in the code.
Something like
me.Subformname.ctlPart_Number.setfocus
where Subformname is the actual name of your subform.
I am not sure that the
DoCmd.FindRecord strFindRecord
will work with that or not, you may have to use a Recodset.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules