=> Open Form passing 'Where' criteria to subform

  • Thread starter Thread starter Rhonda Fischer
  • Start date Start date
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"
----------------------------------------------------------
 
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
 
Back
Top