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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • munkee
    Contributor
    • Feb 2010
    • 374

    #1

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

    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:

    Code:
    Case "Full record"
    DoCmd.Close acForm, "frmHowToReport"
    DoCmd.OpenReport "rptPrintLog", acViewPreview, , "[NCC_ID]=" & Forms![frmlogforfiltering]![subfrmlogforfiltering].Form![NCC_ID]
    DoCmd.Maximize
    DoCmd.RunCommand acCmdFitToWindow
    However, the sub form subfrmlogforfil tering 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.
Working...