Results 1 to 5 of 5
  1. #1
    Roncc is offline Advanced Beginner
    Windows 10 Access 2010 32bit
    Join Date
    Dec 2017
    Posts
    91

    Universal parameters

    Is there a way to establish parameters so that they can be used in several different queries without having to be entered the information into each query. I volunteer for a local food bank and am kind of their IT guy. I have created an Access database that we use to keep track of our clients, name, date of birth, number in household, and City they live in. When grants have to be written I am often asked to create a report that details how many households we have provided service to based on the city where the households reside within a specific date range (i.e. 7/1/2024 to 12/31/2024). I have created "buttons' with code that initiate the reports based on the cities with a query to select for each city but, I have to repeatedly enter the date range for each query. Is there any way to create a "universal" date range parameter that will allow me to just enter the date range one time and have each query refer to that parameter when the query is run?



    Thanks in advance.

    Roncc

  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,652
    Most of us use a form to gather user input for reports. I'd add two textboxes to your form for the dates. Your criteria then looks like this:

    Between [Forms]![frmReportCriteria]![txtFmDate] And [Forms]![frmReportCriteria]![txtToDate]
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Roncc is offline Advanced Beginner
    Windows 10 Access 2010 32bit
    Join Date
    Dec 2017
    Posts
    91
    That did the trick, thanks so much.

    Ron

  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,652
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    I would use TempVars, and probably populated from a form.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

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

Similar Threads

  1. Modified Universal Search
    By orange in forum Code Repository
    Replies: 4
    Last Post: 02-08-2017, 02:14 PM
  2. Universal Form for different sources
    By theperson in forum Access
    Replies: 13
    Last Post: 01-27-2015, 01:22 PM
  3. Universal path for exporting table
    By kspabo in forum Access
    Replies: 5
    Last Post: 08-06-2014, 05:03 AM
  4. Universal Search
    By drunkenneo in forum Programming
    Replies: 1
    Last Post: 05-28-2014, 06:08 AM
  5. Universal Search
    By Douglasrac in forum Access
    Replies: 3
    Last Post: 05-20-2011, 06:25 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