Using Filter by Form to Generate Reports

  • Thread starter Thread starter charles.kendricks
  • Start date Start date
C

charles.kendricks

I have created a form which displays customer records that contains two
subforms using Tab Controls. I am also using the Filter by Form
utility to pull up the records for a specific customer. Is there a way
to generate a report utilizing the data returned from the Filter by
Form results?
 
To do it from within the form use the form's Filter property as the
WhereCondition argument of the OpenReport method, e.g.

DoCmd.OpenReport "YourReport", WhereCondition:=Me.Filter

If you do it from outside th form while its open you'll need to fully
reference the form:

DoCmd.OpenReport "YourReport", WhereCondition:=Forms!YourForm.Filter

One thing you need to watch out for is if the form includes a combo box
bound to a foreign key field but displays the values from an other field in
the referenced table. For instance you might have a combo box bound to
CityID but displays the city name in a text field in the referenced Cities
table. In this case the Filter property uses a syntax which looks up this
value. For the report to understand this it must include a similar combo box
to that in the from to display the city name, which normally would not be
done in a report of course, which would instead be based on a query which
returns the city name in a column by joining the Cities table in the report's
RecordSource.

Ken Sheridan
Stafford, England
 

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

Back
Top