Report based on an open form

  • Thread starter Thread starter Jonny H.
  • Start date Start date
J

Jonny H.

Is it possible to open a report using a command button in
an already open form, and have the recordsource of the
report be based on a filter subform in the form of origin.

An example would be I filter a subform of monthly sales
by choosing June from a combobox. I then click the open
report button on my form, and this report displays only
the sales data pertaining to June.

Thanks,
Jonny H.
 
You can use the same where clause that you apply to the subform filter to
the OpenReport command. I don't know how you are applying the filter to the
subform.
 
Hi Duane,

The filtering technique is technically not the "apply
filter" command. It is actually a series of combo boxes
that can be used in any combination to control the
subform. I basically build a query using the data from
the combo boxes and set that as the new recordsource for
the subform. I'm not sure if this makes a difference. I
should have been clearer.

Thanks,
Jonny H.
 
I assume your code that builds a query is creating a "where clause". Use the
same clause in the DoCmd.OpenReport method.
 
Back
Top