Results 1 to 8 of 8
  1. #1
    SunTop is offline Advanced Beginner
    Windows 8 Access 2016
    Join Date
    Aug 2016
    Posts
    93

    Fridays that have passed from the current month

    hello everyone



    how do you calculate "Fridays" that have passed from the start of the current month ?

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    Do you mean count the number or get the dates?
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    SunTop is offline Advanced Beginner
    Windows 8 Access 2016
    Join Date
    Aug 2016
    Posts
    93
    count the numbers

  4. #4
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,044
    Try the following function, if you want to start from today use the function with parameter datStartDay = Date() )


    Public Function CalcFridays(datStartDay As Date) As Long
    Dim intNrFridays As Integer
    Dim intDay As Integer

    intDay = Day(datStartDay)
    intDay = intDay - DatePart("w", datStartDay, vbFriday)
    Do While intDay > 0
    intDay = intDay - 7
    intNrFridays = intNrFridays + 1
    Loop
    CalcFridays = intNrFridays


    End Function

  5. #5
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Here's another

    General:
    DateDiff("ww",[StartDate],[Endate],6) ' the 6 represents Friday

    use 1-Sun, 2-Mon.....6-Fri, 7-Sat

    Specific:

    ?Datediff("ww",#1-Jan-18#,#24-Jan-18#,6)
    3

  6. #6
    jwhite is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Dec 2012
    Location
    North Carolina
    Posts
    349
    Orange,

    Thank you for posting that! I was just about to start working on a dashboard to calculate shipping days with the exclusion of Sundays between, and your example sparked a simple solution:

    Me.Parent.txtDaysToDeliver = DateDiff("d", Me.DateShipped, Me.DateDelivered) - DateDiff("ww", Me.DateShipped, Me.DateDelivered, 1)

    Cheers!

  7. #7
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Good luck with your project, happy to help.

  8. #8
    SunTop is offline Advanced Beginner
    Windows 8 Access 2016
    Join Date
    Aug 2016
    Posts
    93
    thanks ridders52, NoellaG, orange for your help

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

Similar Threads

  1. Replies: 2
    Last Post: 02-12-2015, 05:14 AM
  2. Get first day and month of current year
    By Ruegen in forum Programming
    Replies: 3
    Last Post: 12-01-2014, 06:45 PM
  3. Replies: 6
    Last Post: 05-05-2014, 10:51 PM
  4. Current Month/Year Query
    By Roadbeer in forum Queries
    Replies: 3
    Last Post: 06-17-2013, 01:20 PM
  5. Current month in a field as default
    By leandrosarno in forum Access
    Replies: 6
    Last Post: 02-09-2010, 05:40 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