Results 1 to 3 of 3
  1. #1
    TimMoffy is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    29

    DateAdd Error

    i have searched high and low for an answer to this but dont always understand some of the answers i am seeing, espeically as everything leads me to believe that I have got my syntax spot on.
    We have a field on a form that needs to display a date five working days after todays date to ensure compliance with our regualator.

    The code i have put in is for the form this is located on is



    OnLoad
    Me.dtm5DayDate = DateAdd("w", 6, [dtmDateReceived])

    But everytime we use this it adds 6 days in total to the date, not just working days. So for today, 17th April it dispalys the 23rd April,because it is counting the Saturday and Sunday as well.
    Any great ideas?
    Thanks as always

  2. #2
    Rawb is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    Are you wanting to include things like holidays (where the non-working day can appear in the middle of a week) or is it good enough that you always add one full week?

    If you don't care about the holidays, then you can just add +1 week (all 7 days) to the date and be done with it:
    Code:
    Me!tdm5DayDate = DateAdd("ww", 1, [dtmDateRecieved])

  3. #3
    TimMoffy is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    29
    Of course 5 working days will always be the same day the following week. You're right i dont care about holidays.
    Thanks

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

Similar Threads

  1. Replies: 4
    Last Post: 03-16-2013, 08:31 AM
  2. DateAdd()
    By cbrsix in forum Programming
    Replies: 3
    Last Post: 11-22-2011, 02:20 PM
  3. DateAdd Function
    By Desstro in forum Programming
    Replies: 3
    Last Post: 04-03-2011, 01:45 PM
  4. DateAdd error in MS Office 2010
    By Noah4x4 in forum Access
    Replies: 7
    Last Post: 03-15-2011, 05:08 PM
  5. dateadd help
    By dubsdj in forum Queries
    Replies: 3
    Last Post: 03-03-2011, 07:22 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