Results 1 to 5 of 5
  1. #1
    ndbennett is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Jul 2017
    Posts
    18

    Filtered Report - How to Record Filter Details on Report Page


    I have a table of shipping records. I want to be able to run a report that lists only the shipments between a specific set of dates so I have created a query with the criteria >=[Start Date] And <=[End Date] then added [Start Date] and [End Date] as parameters. Now I can run the query and enter the dates I want to see a limited selection of shipments - so far, so good.

    I then created a report to show the dates within a selected timeframe, however I would like that the start and end dates are somehow automatically displayed on the report - is that possible? Thanks!

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,576
    Yes it's fairly easy to do.
    Create a string public variable or tempvar.
    In your form, when you select the start / end dates, build your string as something like
    Code:
    strDates ="Between #" & [StartDate] & "# And #" & [EndDate] & "#"
    Next create a function in a module

    Code:
    Function GetDates()
        GetDates=strDates
    End Function
    Now set a textbox on your report equal to GetDates.
    Colin, MVP 2022, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,198
    I think all you need is a textbox on the report:

    ="Between " & [StartDate] & " And " & [EndDate]

    As long as the prompts exactly match the criteria in the query, you shouldn't get prompted twice.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,576
    Hi Paul,

    You may well be right that a simple approach will work fine
    The only reason I suggested the more convoluted way is if the form is closed when the report is opened.
    If so, sometimes the simple method fails as the values may not be in memory
    Colin, MVP 2022, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,198
    What form? The query uses bracketed parameters.
    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: 5
    Last Post: 02-13-2018, 01:57 PM
  2. Replies: 2
    Last Post: 02-04-2016, 08:13 AM
  3. Replies: 3
    Last Post: 12-22-2015, 03:23 AM
  4. Replies: 1
    Last Post: 03-05-2013, 06:38 PM
  5. Filter report on Selcted Details
    By AussieGal in forum Access
    Replies: 1
    Last Post: 12-19-2012, 05:07 PM

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