Results 1 to 3 of 3
  1. #1
    adgembr is offline Novice
    Windows 10 Office 365
    Join Date
    Apr 2021
    Posts
    2

    Unhappy How to repurpose user input from query criteria to generate header on Report

    Hi, I am pretty new to using MS Access and still learning all its features.



    I am using a simple report generation button on a form, which will call a query and find all records for a specific, user defined, date range.
    In the query criteria I ask a simple >=[Start Date] AND <=[End Date]

    For beautification purposes I would like to store that user input in a dynamic StartDateSearch and EndDateSearch field. The end
    goal would be to use those fields to generate a header on the report that reads "Records from" [StartDateSearch] "to" [EndDateSearch].

    Is there a way to save user inputs in this way, or write a subroutine within the criteria field of a query to allocate the input to a field on a report?

    Thanks!

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    8,831
    use a form with date fields: txtStartDate, txtEndDate.
    then the sql is : select * from table where [datefield] between forms!fMyForm!txtStartDate and forms!fMyForm!txtEndDate


    user can manually enter dates in the 2 boxes or pick them in the Picker tool.


    the report caption can then be in the query:
    "Report range between " & forms!fMyForm!txtStartDate & " and " & forms!fMyForm!txtEnddate

    add this field to the report.

  3. #3
    adgembr is offline Novice
    Windows 10 Office 365
    Join Date
    Apr 2021
    Posts
    2
    Oh perfect. I didnt think about creating a form for the user input rather than using the dialog window.

    Worked like a charm, thank you.

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

Similar Threads

  1. Replies: 1
    Last Post: 02-16-2018, 03:38 AM
  2. query criteria to show on report header
    By angie in forum Reports
    Replies: 3
    Last Post: 08-01-2016, 09:59 AM
  3. Replies: 6
    Last Post: 01-02-2016, 02:54 AM
  4. Replies: 3
    Last Post: 03-11-2013, 05:11 PM
  5. Replies: 6
    Last Post: 07-22-2010, 05:53 PM

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 - Senior Forums