Results 1 to 6 of 6
  1. #1
    sdel_nevo is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2013
    Location
    Gloucester, UK
    Posts
    402

    datediff problem

    Hi Guys

    I think I might be doing something really silly here the problem I have is this

    when trying to work out the days between to dates using this



    DateDiff("d", [Forms]![UnexCapacityDatesSelectionForm]![StartDate], [Forms]![UnexCapacityDatesSelectionForm]![EndDate])
    this gives the number of days including weekend

    replacing with this
    DateDiff("w", [Forms]![UnexCapacityDatesSelectionForm]![StartDate], [Forms]![UnexCapacityDatesSelectionForm]![EndDate])

    or this
    DateDiff("ww", [Forms]![UnexCapacityDatesSelectionForm]![StartDate], [Forms]![UnexCapacityDatesSelectionForm]![EndDate])

    returns the same value?

    am I right in thinking that "W" = weekdays and "WW" = Weeks between the two dates
    if this is correct has anyone got any idea why it's not working and returning the same figure for both.

    many thanks

    Steve

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,746
    There are some functions and dialogs at this link that may be useful to you.
    http://www.access-programmers.co.uk/...d.php?t=133329

  3. #3
    sdel_nevo is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2013
    Location
    Gloucester, UK
    Posts
    402
    Hi Orange

    many thanks

    will look into these links
    many thanks again

    Steve

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,972
    "w" and "ww" return the same results. So no, "w" does not mean weekdays. There is no intrinsic function or parameter that will ignore weekends and holidays when counting days. This requires custom VBA function. Common topic.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    sdel_nevo is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2013
    Location
    Gloucester, UK
    Posts
    402
    Hi June

    Thanks for the reply, I have studied the links that orange sent over and have used this information to get the results I required.

    I'm slowly getting to grips with vba whilst at times it can be extreamly frustrating I have to say that on the whole I have really enjoyed the challenge.

    Many thanks again
    Steve

  6. #6
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,746
    @Steve
    Glad you have resolved the issue.
    vba can be frustrating, but make sure you have a clear statement/understanding of WHAT you are trying to accomplish.
    You can always get help in this forum if you have given an honest try, and ask a clear question(s).

    Good luck.

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

Similar Threads

  1. Replies: 13
    Last Post: 10-12-2011, 11:08 AM
  2. datediff problem
    By dseeburg in forum Queries
    Replies: 3
    Last Post: 04-07-2011, 06:05 AM
  3. DateDiff
    By mrkaye in forum Forms
    Replies: 18
    Last Post: 11-19-2010, 08:19 AM
  4. DateDiff
    By ROB in forum Access
    Replies: 2
    Last Post: 10-30-2010, 03:58 AM
  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