Results 1 to 5 of 5
  1. #1
    dyhunter is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    May 2014
    Posts
    9

    Query adding to expression

    I have a small DB tracking some tools. In one of my queries, I have one field with an expr. that gets "today's" date, then in the next field, gives me the date a specific interval from today. This then is used with a report to print labels for the tools. This works.

    Now I need to add a similar query that will do almost the same thing, but instead of getting today's date, it asks for a date, then add to that. This is so when needed I can reprint a label if needed. I even made a copy of the first query, then just changed the expr to ask for the date I want there. The query does ask for the date to use, the problem is that rather then giving me the new date , it shows #ERROR.

    What did I miss?
    Attached Thumbnails Attached Thumbnails ERROR 1.png   ERROR 2.png  

  2. #2
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Try this:
    Code:
    Expr2: DateAdd("d",[Interval],[Expr1])

  3. #3
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    I would point out that the failing version has a space in the input date, making it invalid. Most of us use forms to gather user input, one reason being you can validate the input first.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    dyhunter is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    May 2014
    Posts
    9
    Quote Originally Posted by JoeM View Post
    Try this:
    Code:
    Expr2: DateAdd("d",[Interval],[Expr1])

    Worked great, thanks.

  5. #5
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    You are welcome.

    You may want to look into Paul's suggestion too, as that gives you more control over the Data Type of the input.
    Another alternative I sometimes use is make a one row input table, where you take in the parameter values, and include that table in your query. Like Paul's suggestion, that also gives you control of the Data Type.

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

Similar Threads

  1. Adding row ID to an expression
    By JimO in forum Queries
    Replies: 12
    Last Post: 09-14-2016, 08:47 PM
  2. Adding a 3rd condition in IIf(IsNull expression
    By Holli in forum Programming
    Replies: 2
    Last Post: 05-20-2015, 01:04 PM
  3. Replies: 2
    Last Post: 12-21-2013, 11:37 AM
  4. Replies: 1
    Last Post: 07-21-2013, 09:40 PM
  5. Replies: 3
    Last Post: 04-30-2013, 05:32 AM

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