Results 1 to 2 of 2
  1. #1
    seanpbent is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2013
    Posts
    7

    Subtracting Dates in Queries

    My form consists of a textbox with a selected date. I have a combo box with integers 1-15. I have a table with 15 people and their birthdays.



    I am trying to find the birthdays after a selected date by the integer selected in the combo box. For example, if I select 2/1/2013, and pick 7 in the combo box, the subform should show me people with birthdays 2/1 through 2/8.

    I have a query with a datediff function. This is my query expression Expr1: DateDiff("d",[DateofBirth],[Forms]![Calendar]![Text1]) The criteria is <=[Forms]![Calendar]![Combo3].

    It displays some data, but it's not consistent at all. I'm hoping to fix this without any SQL changes or form code. But if that's what I need, I'll do it.

    I'm using access 2010, and I'm fairly new at it. Sorry if I'm posting to the wrong place.

  2. #2
    ketbdnetbp is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Mar 2011
    Location
    Midwest
    Posts
    254
    seanpbent -

    You could try...

    Between [forms]![Calendar]![Text1] And DateAdd("d",[forms]![Calendar]![Combo3],[forms]![Calendar]![Text1])

    in the criteria row of the "DateofBirth" field. Delete the column "exp1" or delete the criteria row text in that field. Assumes [Text1] is a date field.

    See if that produces the desired results.

    All the best,

    Jim

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

Similar Threads

  1. vba > subtracting time
    By metokushika in forum Access
    Replies: 2
    Last Post: 12-09-2014, 09:17 PM
  2. Subtracting two records
    By laipeka in forum Queries
    Replies: 2
    Last Post: 08-30-2012, 04:12 AM
  3. Replies: 1
    Last Post: 06-09-2011, 09:15 AM
  4. Dates and Queries (its hard to describe!)
    By Lauren1989 in forum Queries
    Replies: 6
    Last Post: 03-31-2011, 01:45 PM
  5. Handling dates in queries
    By mrk68 in forum Access
    Replies: 4
    Last Post: 03-23-2009, 06:35 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