Results 1 to 4 of 4
  1. #1
    LeesKeys is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2011
    Posts
    5

    datediff function in query

    I have query which I need to run once a year on July 1. The query is set up to compute the difference in months between the client's birthdate and July of the current year. The criteria is that the result is greater than 59. I want to make this query easier for the average employee to run by allowing them to enter the july 1 date when the query opens, rather than having to go into design mode and manually change the date. I've set up plenty of "enter parameter" queries in the past but have no idea how to accomplish this when the datediff function is involved.



    Click image for larger version. 

Name:	datediff query.png 
Views:	9 
Size:	10.1 KB 
ID:	25004

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    age: DateDiff("m",[dob],[Enter Date])

    if you want it for the client,
    DateDiff("m",[dob],Date())

  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,642
    You can do the same thing, use

    [Enter date]

    there, or whatever the appropriate text is.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    LeesKeys is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2011
    Posts
    5
    so simple! thanks!!

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

Similar Threads

  1. Expression Builder - Function DateDiff
    By geraldk in forum Access
    Replies: 2
    Last Post: 04-01-2015, 12:08 PM
  2. Replies: 1
    Last Post: 07-19-2013, 12:00 PM
  3. DateDiff function
    By stavros in forum Access
    Replies: 18
    Last Post: 06-01-2013, 07:16 PM
  4. DateDiff Function
    By Nixx1401 in forum Access
    Replies: 4
    Last Post: 04-14-2011, 09:27 AM
  5. DateDiff function
    By Scott R in forum Reports
    Replies: 5
    Last Post: 12-03-2008, 07: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