filter report by value in subform

lbs

Registered User.
Local time
Today, 06:09
Joined
Dec 22, 2019
Messages
109
Hello experts

I have a form which has a subform. At the bottom of the main form I have a button for opening a report. I want that report to be filtered according to the value showing in one filed of the subform. Is it possible to achieve? How to write a where condition in the Open report command?

Many thanks
 
the query for the report would use the selected record as the criteria.
open the form (w the subform)
make a query, then use the BUILDER to insert the criteria.
select active forms
your form, then the subform,
then the field (txtbox).
 
Hi. Also, if you use the OpenReport method, there is a WhereCondition argument. For example:
Code:
DoCmd.OpenReport "ReportName", acViewPreview, , "ReportFieldName='" & Me.SubformContainerName.Form!FieldControlName & "'"
That's assuming it's a Text field.
 
theDBguy, Ranman256,
Many thanks

It works now
 

Users who are viewing this thread

Back
Top Bottom