Results 1 to 4 of 4
  1. #1
    JimO is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Dec 2015
    Posts
    126

    Help with date parts

    I want a formula to display the date of the next 4th Wed. of the month, that would also roll over to next month if necessary.



    Date parts confuse me.

    Thanks
    Jim O

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Likely someone will figure this out before me, but I think you at least need to tell us what the input will be. One needs something to work with be that any date, or any date in any given month, or the current date...
    Since today is 08/11/2019 (aug) the result you are looking for is Aug 28?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    JimO is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Dec 2015
    Posts
    126
    The current date. I can use Date(), I think.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Look at http://www.cpearson.com/excel/DateTimeWS.htm - see the item "Nth Day Of Week For A Month And Year". Those formulas are for Excel. Adapted for Access and calculated in Immediate Window:

    ?Date() + 29 - Day(Date())-Weekday(Date()-Day(Date())-3)
    8/28/2019

    And with the first day of month:

    ?#8/1/2019#+28-Weekday(#8/1/2019#-4)
    8/28/2019

    Since if the given date is after 4th Wed, you then want next month's 4th Wed, write a VBA custom function to return appropriate date. Something like:
    Code:
    Function GetWed(dteDate As Date) As Date
    Dim dteWed As Date
    dteWed = dteDate + 29 - Day(dteDate) - Weekday(dteDate - Day(dteDate) - 3)
    GetWed = dteWed
    If dteDate > dteWed Then
        GetWed = DateAdd("m", 1, dteDate) + 29 - Day(DateAdd("m", 1, dteDate)) - Weekday(DateAdd("m", 1, dteDate) - Day(DateAdd("m", 1, dteDate)) - 3)
    End If
    End Function
    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. Parts List on Parts Requisition Report
    By billgyrotech1 in forum Access
    Replies: 16
    Last Post: 06-03-2019, 01:17 PM
  2. Replies: 2
    Last Post: 11-02-2016, 07:28 AM
  3. Parts bin labeles
    By weymes in forum Reports
    Replies: 3
    Last Post: 03-08-2015, 04:07 PM
  4. Replies: 3
    Last Post: 08-02-2012, 11:37 AM
  5. field parts
    By DavidAlan in forum Queries
    Replies: 3
    Last Post: 09-07-2010, 01:36 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