Results 1 to 4 of 4
  1. #1
    Cran29 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    38

    Date diff trouble


    Expr1: DateDiff("d",[DateFrom],[DateTo]) Can any one please explain why when i use this expression it does not count the starting date. I have a field in my callender called [IsWeekDay] how would i include this to enable it to only count weekdays betwen the dates.

  2. #2
    William McKinley is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    59
    Quote Originally Posted by Cran29 View Post
    Expr1: DateDiff("d",[DateFrom],[DateTo]) Can any one please explain why when i use this expression it does not count the starting date. I have a field in my callender called [IsWeekDay] how would i include this to enable it to only count weekdays betwen the dates.
    DateDiff isn't set up to include the start date. Attaching a +1 to the end of your function will add an additional day to the count.

    Code:
    DateDiff("d",[DateFrom],[DateTo])+1
    I don't believe that Access has a Weekday count function, but it can be achieved through VBA. See article below:

    http://msdn.microsoft.com/en-us/libr...ffice.12).aspx

  3. #3
    Cran29 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    38
    I have a field in my callender called IsWeekday to enable me to identify weekdays how would I add this to the expression. Or would I need to do another query before addin the date diff part

  4. #4
    William McKinley is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    59
    Quote Originally Posted by Cran29 View Post
    I have a field in my callender called IsWeekday to enable me to identify weekdays how would I add this to the expression. Or would I need to do another query before addin the date diff part
    I recommend using the Weekdays() function detailed in the article I posted previously. It works great!

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

Similar Threads

  1. Replies: 3
    Last Post: 06-29-2012, 01:33 AM
  2. Trouble with (R)
    By NOTLguy in forum Access
    Replies: 3
    Last Post: 10-29-2010, 11:55 AM
  3. Iff trouble
    By JackT in forum Access
    Replies: 3
    Last Post: 08-18-2010, 02:28 PM
  4. Check time Diff.
    By wes028 in forum Access
    Replies: 3
    Last Post: 03-08-2010, 10:05 AM
  5. Hi ! Im having time trouble
    By gayano in forum Access
    Replies: 0
    Last Post: 06-28-2007, 12:10 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