Newbie: Create report on Filter by Form recordset?

  • Thread starter Thread starter Brian Beam
  • Start date Start date
B

Brian Beam

Greetings. I apologize in advance if this has been answered before, but I'm
rarely in the forum and I'm a very infrequent user of Access...

I'm using Access 2000 and I'd like to create a report based on the results
of a recordset produced by the "Filter By Form" option. Ideally it would
work this way... the user would filter the recordset from within their
primary data entry form, then click on a button which would open their
report, which would display the same set of filtered records. (It would also
be great if I could list the filter criteria in the report header.)

Is this possible?

TIA,

Brian
 
Try code to open the report like:
Dim strWhere as String
strWhere = Me.Filter
DoCmd.OpenReport "rptYourReport", acPreview, , strWhere
You can have a text box in your report with a control source of:
=[Filter]
 
I have a follow-up question to my earlier post...

I would like to display a Count() of the filtered records in my report. I
tried creating a text box in my footer with =Count([Filter]) but it produces
#Error.

Any tips?

Thanks,

Brian
 
Try:
=Count(*)
Use this in the Report Header or Footer.

--
Duane Hookom
Microsoft Access MVP


Brian Beam said:
I have a follow-up question to my earlier post...

I would like to display a Count() of the filtered records in my report. I
tried creating a text box in my footer with =Count([Filter]) but it produces
#Error.

Any tips?

Thanks,

Brian

Try code to open the report like:
Dim strWhere as String
strWhere = Me.Filter
DoCmd.OpenReport "rptYourReport", acPreview, , strWhere
You can have a text box in your report with a control source of:
=[Filter]
 
Thanks for the prompt reply. In the meantime, I had tried that, as well as
doing a =Count([RecID]) (the PK value of the table). Both still produce a
#Error.
 
1) make sure the name of the text box is not the name of a field.
2) what section is your text box located in?

--
Duane Hookom
Microsoft Access MVP


Brian Beam said:
Thanks for the prompt reply. In the meantime, I had tried that, as well as
doing a =Count([RecID]) (the PK value of the table). Both still produce a
#Error.

Try:
=Count(*)
Use this in the Report Header or Footer.
 
1) make sure the name of the text box is not the name of a field.
2) what section is your text box located in?

#2 was the problem... I had the text box in the Page Footer. It works
properly when placed in the Report Footer.

Thanks much for your help.

Brian
 
You should reply to the other thread you started so Marsh knows the issue
has been resolved. It is seldom necessary to start multiple threads of the
same question.
 
Back
Top