=> Open Form passing 'Where' criteria to subform

R

Rhonda Fischer

Hello,

I want to pass WHERE parameters, date values,
to the continuous subform of a parent form
called frmIncidentPerDepot. However I notice that
the filter of the parent form
receives these date values while the subform does not.

How do I pass the WHERE parameters to the subform?
As the parent form is just a background form.

Thank you kindly
Rhonda

==========================================================
Code calls parent form from Criteria Form:
==========================================================
TRIED: Unsuccessful can't find form called
----------------------------------------------------------
DoCmd.OpenForm "Forms!frmReportIncidentPerDepotAll!
frmReportIncidentPerDepotAllSub", , , "IncidentDate >= #"
& Format(Me!txtDateFrom, "yyyy-mm-dd") & "# AND
IncidentDate <= #" & Format(Me!txtDateTo, "yyyy-mm-dd")
& "# AND AccDangerousOcc = 1"
----------------------------------------------------------
THIS WORKS BUT DOESN'T SEND DATE RANGE TO SUBFORM
DoCmd.OpenForm "frmReportIncidentPerDepotAll", , , "Inciden
tDate >= #" & Format(Me!txtDateFrom, "yyyy-mm-dd") & "#
AND IncidentDate <= #" & Format(Me!txtDateTo, "yyyy-mm-
dd") & "# AND AccDangerousOcc = 1"
----------------------------------------------------------
 
A

Alphonse Giambrone

There are several ways to do this.
One is to pass the 'where' clause to the parent form via the openargs.
Then in the open event of the parent form apply it as the filter to the
subform.

air code
me!mysubform.form.filter = me.openargs
me!mysubform.form.filteron = true
 

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