Results 1 to 13 of 13
  1. #1
    baulrich is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    23

    Use filtered subform recordset as recordsource for Report

    I have a Form that contains a subform which is a continuous form. The main form has a couple buttons that I've programmed to allow the user to filter the recordset. I also allow the user to further filter and sort the continuous subform using the built-in Access sort/filters. I want the user to be able to "print the filtered list". How can I change my report so that it is based on the filtered results shown in the subform and not the entire query on which the subform is based?

    I've tried:



    passing Me.Filter to the Report with "DoCmd.OpenReport stDocName, acViewPreview, Me.Filter"

    thanks in advance.....

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Untested, but try

    DoCmd.OpenReport stDocName, acViewPreview, , Me.Filter
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    baulrich is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    23
    That didn't work either.... passing the Filter as the where condition instead of the FilterName.

    I also have tried

    DoCmd.OpenReport stDocName, acViewPreview, Me.subformname.form.Filter
    and
    DoCmd.OpenReport stDocName, acViewPreview, , Me.subformname.form.Filter

    In all cases, the report opens fine, but does apply the filter as desired.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Can you post a sample db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    Just a thought.
    Sometimes during development a filter gets "stuck" in the report filter property.
    Check that to see that it is empty.

    Dale

  6. #6
    baulrich is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    23
    Hey guys... thanks, but no luck yet. I did check the filter property in the report. It was in fact defined - the filter was set to the exact same value as the Record Source. I cleared that value, saved it and tried all the combinations that I've already tried. Still no luck. My report record source is set to use the same query that my continuous subform uses. Should I instead be using the actual recordset of the continous subform as the record source for my report? Is that even possible?

    Paul... thanks for the offer to take a look at the DB. It is a split DB with the BE being referenced via linked UNC path. Would it suffice to just upload the FE file? Or would you need both? I will try to get you something to look at if I don't come up with a solution soon.

    thanks...

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Would need both to be able to test, or at least a representative self-contained sample.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    Make a new query from your existing query.
    We need the results you are getting from the query for the form.
    In the new query, add "*" & Forms!YourMainFormName!TextboxName & "*"
    for the fields you are filtering.

    Use this query for the report.

    Just an idea I had.

    Dale

  9. #9
    baulrich is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    23
    OK guys... I have uploaded files. Let me know if you have trouble.

    Quick instructions on how to get to the problem in question:

    Open the FE file,
    Click "Bids"
    Double-Click the only pending bid in the listbox
    Change to the "response reports" (2nd tab)
    Click the "print report" button

    Then close the report and notice that when the continuous form is filtered and the report is printed again, it still prints the full list.

    thanks again in advance.....
    Attached Files Attached Files

  10. #10
    baulrich is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    23
    One more thing.... To run, place all files in location c:\temp\ and they should run. The FE file is expecting both BE files to be at that location.

  11. #11
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    This seems to work as advertised:

    Code:
    DoCmd.OpenReport stDocName, acViewPreview, , Me.frm_bid_Edit_solicited_companies_subform_by_Div.Form.Filter
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  12. #12
    baulrich is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    23
    Thanks... That did the trick. I apologize; I certainly thought that was one combination that I tried.

  13. #13
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 07-28-2014, 01:15 PM
  2. To get SQL of loaded recordset (not recordsource)
    By mercapto in forum Programming
    Replies: 2
    Last Post: 12-12-2012, 10:32 AM
  3. Replies: 3
    Last Post: 11-06-2012, 03:25 PM
  4. Update Subform Recordsource
    By mystifier in forum Forms
    Replies: 8
    Last Post: 11-15-2010, 03:03 AM
  5. update recordsource of subform
    By AndyKim in forum Forms
    Replies: 1
    Last Post: 06-16-2009, 09:15 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums