Results 1 to 4 of 4
  1. #1
    jhaynes is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    2

    User input but one year earlier

    Hello,
    Is there a way I can ask the user for input such as below, and perform subtraction on a specific value, precisely the year?



    I am currently entering a date range to run a query with the following command:

    Between [Enter start date (yyyy-mm-dd)] And [Enter end date (yyyy-mm-dd)]

    This works as it is supposed to. The problem is I need this value, but in a subreport I need the previous year. So if the user types 2011-01-01 and 2011-02-04. I need to modify this as 2010-01-01 and 2010-02-04. Likewise I would need to go back 25 years for the same period.

  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,643
    Well, you can add a field to your query, like:

    StartDate: [Enter start date (yyyy-mm-dd)]

    which will put the date in the results. Most of us use forms to gather user input, as you have more control. If you did that, you'd have it available for anywhere.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    jhaynes is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    2
    A form would be extra work, as all the report requires is the date, which works. I get the correct information using Between [Enter start date (yyyy-mm-dd)] And [Enter end date (yyyy-mm-dd)]
    which then passes the information to a subreport. The subreport calls a seperate query which requires yyyy-1-mm-dd where the year is one less.

  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,643
    Having more control and flexibility is typically more work to set up, but it pays off in the long run.
    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. How to take a user input
    By iamraja5 in forum Access
    Replies: 1
    Last Post: 05-12-2011, 10:17 AM
  2. Reporting with user input
    By tazbergy in forum Reports
    Replies: 1
    Last Post: 09-12-2010, 11:26 PM
  3. User Input Query
    By ManC in forum Queries
    Replies: 2
    Last Post: 03-04-2010, 07:09 PM
  4. Chart with user input
    By mungyun in forum Access
    Replies: 1
    Last Post: 12-28-2009, 07:44 PM
  5. Set required user input
    By ZeusOsiris in forum Database Design
    Replies: 2
    Last Post: 12-04-2006, 07:13 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