Results 1 to 6 of 6
  1. #1
    BLFOSTER is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jun 2013
    Posts
    68

    First and Last Working Days of Month

    Hi. I want to count the number of entries in a field between the first working day of the month and the last working day of the month. I found a couple of functions seen below but just get #error# in my textbox.



    Example:

    April 2014 would be March 31st to May 2nd:

    =DCount("*","MyQuery","[MyDate] between FirstWorkday(Month()) and LastWorkday(Month())")

    Any ideas?

    Thanks!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    The Month() function has a required argument. Do you want the criteria to be the current month? Do the functions return date value or string? If the function returns a string will probably need # delimiters.

    =DCount("*","MyQuery","[MyDate] between #FirstWorkday(Month(Date()))# and # LastWorkday(Month(Date()))#")

    Might have to concatenate calls to custom functions.

    =DCount("*","MyQuery","[MyDate] between #" & FirstWorkday(Month(Date())) & "# and #" & LastWorkday(Month(Date())) & "#")
    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.

  3. #3
    BLFOSTER is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jun 2013
    Posts
    68
    Neither of the above examples work, but I think that is due to the functions. Upon further inspection, the functions I found are not what I need - it appears their purpose is to exclude holidays and week-ends in the month. I guess the criteria would have to be the previous month....we are in May, but I want to return a count for April (which includes May 1 and 2 and March 31). I actually have no idea how to get where I need to go with this..........

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    What do you mean April includes May 1 and 2 and March 31? You want beginning and ending of week? Never seen that for a monthly aggregation and does complicate.
    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
    BLFOSTER is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jun 2013
    Posts
    68
    Yes, the beginning of the first week and the end of the last week in the month.....regardless of the actual date.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    1. take first day date and return date of first day of that week

    2. take last day date and return date of last day of that week

    Review http://www.tek-tips.com/faqs.cfm?fid=3103
    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.

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

Similar Threads

  1. Counting Number of Days (not records) in a Month
    By Tomfernandez1 in forum Reports
    Replies: 10
    Last Post: 01-29-2014, 02:54 PM
  2. Replies: 2
    Last Post: 05-19-2013, 06:03 AM
  3. To find Month and Days in given date period
    By waqas in forum Programming
    Replies: 1
    Last Post: 02-12-2013, 02:50 PM
  4. Replies: 3
    Last Post: 06-19-2012, 10:42 PM
  5. Total no of days in a month
    By wasim_sono in forum Forms
    Replies: 4
    Last Post: 10-15-2006, 01:05 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