Results 1 to 2 of 2
  1. #1
    JR93 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2011
    Posts
    1

    Unhappy DateDiff Trouble Please Help a Newbie!

    Hi guys this is my first post so sorry if it is the wrong section (I tried lol)
    Iv'e got a DateDiff calculation in a query for my A Level project, trouble is intead of it giving me the actual days between my two desired dates it gives me the actual date between the first date and the date today

    BTW this is what it looks like in SQL view: SELECT TBLBIKE.BIKE_ID, TBLBIKE.[CUSTOMER_ID*], TBLBIKE.BSTARTDATE, TBLBIKE.BNAME, TBLBIKE.BEQUIP, TBLBIKE.BDEADLINE, DateDiff("D", [BSTARTDATE],Date()) AS ACTUALDAYS
    FROM TBLBIKE;



    I would like it to workout the days between BSTARTDATE and BDEADLINE

    Any help muchos appreciated!
    Last edited by JR93; 03-28-2011 at 03:49 PM. Reason: Missed code out

  2. #2
    pkstormy's Avatar
    pkstormy is offline Access/SQL Server Expert
    Windows XP Access 2003
    Join Date
    Mar 2010
    Location
    Madison
    Posts
    682
    SELECT TBLBIKE.BIKE_ID, TBLBIKE.[CUSTOMER_ID*], TBLBIKE.BSTARTDATE, TBLBIKE.BNAME, TBLBIKE.BEQUIP, TBLBIKE.BDEADLINE, DateDiff("D", [BSTARTDATE],Date()) AS ACTUALDAYS
    FROM TBLBIKE;
    would be:
    SELECT TBLBIKE.BIKE_ID, TBLBIKE.[CUSTOMER_ID*], TBLBIKE.BSTARTDATE, TBLBIKE.BNAME, TBLBIKE.BEQUIP, TBLBIKE.BDEADLINE, DateDiff("D", [BSTARTDATE],[BDEADLINE]) AS ACTUALDAYS
    FROM TBLBIKE;
    or reverse the 2 date fields in: DateDiff("D", [BSTARTDATE],[BDEADLINE])

    the above is providing that BDEADLINE is an actual date value and not a number. If it's a number (ie. designating # of days from the BStartDate), then you'll need to embed a dateadd in the expression such as:

    DateDiff("D", [BSTARTDATE],DateAdd("d",[BDEADLINE],[BSTARTDATE]))

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

Similar Threads

  1. DateDiff
    By mrkaye in forum Forms
    Replies: 18
    Last Post: 11-19-2010, 08:19 AM
  2. DateDiff
    By ROB in forum Access
    Replies: 2
    Last Post: 10-30-2010, 03:58 AM
  3. How to use DateDiff?
    By teirrah1995 in forum Queries
    Replies: 10
    Last Post: 10-19-2010, 12:07 PM
  4. Need Help with Datediff
    By gonzod in forum Access
    Replies: 5
    Last Post: 08-26-2010, 02:29 PM
  5. Datediff
    By greggue in forum Queries
    Replies: 2
    Last Post: 08-13-2010, 03:53 PM

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