filtering a mainform using data from a field in a subform

  • Thread starter John S. Ford, MD
  • Start date
J

John S. Ford, MD

I have a main form whose underlying query lists a number of teams (A, B, C,
etc.) This main form has a subform listing the patients followed by each
team.

I've set up a search form that allows the user to select a patient and
thereby open the above main form with that patient listed in the subform.
The main form is set to look at the particular team of that patient.

What I want, however, is for the main form to filter ONLY the team following
that particular patient. As it is now, only the correct patient is listed
on the subform but the main form still has ALL the teams (not only the
patient's team).

I figure I need to use DAO's and I've tried something like this:

Dim rst As Recordset
Set rst =
Forms!frmMainEntryForm!sbfctlPatientInformation.Form.RecordsetClone
Forms!frmMainEntryForm.Filter = "TeamIDNum = " & rst!TeamIDNum

I get an error on line 3. Apparently I'm not referencing the TeamIDNum
field correctly. Any idea what I'm doing wrong here?

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top