Using a find form

sdkramer

Registered User.
Local time
Today, 05:49
Joined
Mar 19, 2002
Messages
64
I have a form that I want to use to find a record in several other forms. As it stands I have it working for the one form, but I'm having trouble adding it. I have a command button that opens the form. and then on record selection and clicking ok it uses findfirst and moves to the record in the one form. How do I make this work for more than one. Here's what I have so far

Private Sub cmdChild_Click()

DoCmd.OpenForm "frmFindChild"

End Sub

This is the code that opens the form.

Private Sub cmdFindRecord_Click()
Dim rst As DAO.Recordset


'Find the record and then close the dialog box
Set rst = Forms!frmFamily.RecordsetClone
rst.FindFirst "FamilyID = " & "'" & lstFindChild & "'"
Forms!frmFamily.Bookmark = rst.Bookmark
DoCmd.Close acForm, "frmFindChild"

End Sub

And this finds the relevant data in the frmFamily form. How can I get this to work for another form, say the frmAdult? Can I pass the name of the form to the frmFindChild form and fetch that as a variable somehow? I'm open for ideas. If I really needed to I could make a copy of this table and change only the VB code but that would be sloppy.

TIA,

Seth
 
I don't quite follow what you are doing but you can use code like this to open other forms to the existing ID on the current form:

DoCmd.OpenForm "FormName", , ,"[FamilyID] = '" & Me.FamilyID & "'"
 

Users who are viewing this thread

Back
Top Bottom