By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,786 Members | 2,241 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,786 IT Pros & Developers. It's quick & easy.

How to filter report based on records shown in a sub form?

P: 374
Hi all,

This would normally be quite simple however for some reason I can not getting working.

My code to open my report filtered to a primary key is as follows:

Expand|Select|Wrap|Line Numbers
  1. Case "Full record"
  2. DoCmd.Close acForm, "frmHowToReport"
  3. DoCmd.OpenReport "rptPrintLog", acViewPreview, , "[NCC_ID]=" & Forms![frmlogforfiltering]![subfrmlogforfiltering].Form![NCC_ID]
  4. DoCmd.Maximize
  5. DoCmd.RunCommand acCmdFitToWindow
However, the sub form subfrmlogforfiltering has a recordsource of a query which within it contains the primary key of my main table.

I use a search which filters the subform down to records I require.

I want to be able to print these records out, however the current data shown is only an overview. My report contains all the information behind each of those records (the whole record info).

How do I pass a filtered subform who's recordsource is filtered from a query to a report...

When I submit the above code all that is returned is 1 record, sometimes there are more than one record returned, but the report still only shows the first.
Nov 30 '10 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.