open a second form with DAO

  • Thread starter Thread starter Philippe
  • Start date Start date
P

Philippe

Hi,

I have two forms:
Institutions
Members (linked with Institution with an ID)

I open both form through DAO in form_load() with
Set rs = db.openRecordset(strSQL)
/* strSQL is like "SELECT * FROM data" */
I need to be able to open each form with all the data.

So each form open correctly.

The problem arise when I want to open Members from
Institutions with a parameter (Institutions.ID).
The only thing I know is DoCmd.openForm("Members") which
gives me all the data, because it activates form_load().
But I only want to open the data which match the ID from
Institutions. Any idea?

I've made a function filterRecord(strCriteria) in Members
which close the recordset and open it with a new one. But
I don't know how to call it from Institutions.

:P hilippe
 
To open the members form from the Inst form, simply go:

docmd.OpenForm "frmMembers",,,"InstitutionsID = " & me.ID
 
All right, I have found it.

I just needed to change the FilterRecord to public and
call it like that from Institutions.

Form_Members.FilterRecord(strCriteria)

Thanks for anyone who replied.

:P hilippe
 
Back
Top