Results 1 to 3 of 3
  1. #1
    tbjmobile@gmail.com is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    127

    DateDiff result to table field


    New to Access 2016 and the forum.
    Hi Everyone, I've switched from Aplha 5 to Access and I need to display as a field in the table entry the difference between 2 dates (arrive and depart). Alpha 5 has a similar version of VB and can display the result in the table fileds called Nights.
    I could do this easily before but it doesn't seem so easy in Access. I've tried the DateDiff function but I can't work out how to just have it calculate AND display it in the table so that the operator can choose how many times the apartment is cleaned during a holiday. Once per week is standard so doesn't need any calculation but if a holiday goes over 9 days but isn't 14, then an intermediate clean needs to be organised. Maybe it could be done by number of the two dates and simple maths?
    Thanks for any help,
    Trevor Johnson

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    DateDiff IS the answer

    in a query , calc:
    DateDiff("d",StartDate,EndDate)
    or
    NextCleanDate: DateAdd("d",[NumDays],[LastCleanDate])


  3. #3
    tbjmobile@gmail.com is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    127
    Thank you, I was working on your suggestion and I thought of 'Int' as I looked through the functions list. Int([Depart]-[Arrive]) works and gives me the number of days between [arrive] and [depart]. Thank you for your prompt suggestions.
    Trevor.

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

Similar Threads

  1. Replies: 2
    Last Post: 11-27-2013, 05:24 PM
  2. Replies: 3
    Last Post: 01-09-2013, 03:39 PM
  3. Replies: 1
    Last Post: 01-09-2013, 02:42 PM
  4. Replies: 3
    Last Post: 11-07-2011, 10:41 AM
  5. Programming a result field in a table
    By Linda in forum Programming
    Replies: 9
    Last Post: 07-13-2009, 08:07 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