Results 1 to 2 of 2
  1. #1
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,185

    Return the next 2 Wednesday dates

    Hi Guy,s firstly i sincerely you are all well and staying safe through these unprecedented times



    This should be easier than i am trying to make it, how can i return the dates in an input box for the next 4 Wednesday's / Thursday dates

    So if it is Tuesday Today then return Wednesday / Thursday dates of THIS week as the 1st date then the next 4 weeks dates
    If it is Wednesday today then return next Wednesday / Thursday dates NEXT week then the next 3 weeks dates as we have disregarded this week as it is already Wednesday

    When i test the below, the inputbox comes with False in it, i am unsure if the "now" is including hours, minutes and seconds so that is why i tried Formatting the Date Add lines

    This should be easier than i am making it!!

    The result i am looking for is for an input box to come up with the next 4 Wednesday / Thursday dates and by adding a number, it returns the Wednesday date selected by the input box number

    Once i can work the first 2 then i can follow the correct method and add 4 cases to the input box

    Hope all of this makes sense

    Code:
    Dim Wed1 As Date, Wed2 As Date, Wed3 As Date, wed4 As DateDim thur1 As Date, thur2 As Date, thur3 As Date, thur4 As Date
    Dim DateOffer As String
    Dim optInput As Integer
    
    Wed1 = Format(DateAdd("d", 8 - Weekday(Now, vbWednesday), Now), "dddd-dd-mmmm-yyyy")
    thur1 = Format(DateAdd("d", 9 - Weekday(Now, vbThursday), Now), "dddd-dd-mmmm-yyyy")
    Wed2 = Format(DateAdd("d", 15 - Weekday(Now, vbWednesday), Now), "dddd-dd-mmmm-yyyy")
    thur2 = Format(DateAdd("d", 16 - Weekday(Now, vbThursday), Now), "dddd-dd-mmmm-yyyy")
    
    
    optInput = InputBox("Enter Which Date To Provisionally Add ?" & vbNewLine & vbNewLine & _
    "1" = Wed1 & "-" & thur1 & vbNewLine & _
    "2" = Wed2 & "-" & thur2, "WHICH WEEK ?")
    Select Case OptInput
    Case 1
    DateOffer = Wed1 & " / " & thur1
    Case 2
    DateOffer = Wed2 & " / " & thur2
    End Select

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Take a look at the attached db which has many useful date functions. I'm sure there'll be one that does what you require or which could be adapted for your needs.
    Attached Files Attached Files
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

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

Similar Threads

  1. Replies: 6
    Last Post: 08-09-2018, 11:41 PM
  2. 1st or 3rd Wednesday 90 days out.
    By Thelaxman in forum Queries
    Replies: 1
    Last Post: 06-10-2015, 05:47 PM
  3. Replies: 7
    Last Post: 10-03-2014, 12:31 PM
  4. Replies: 3
    Last Post: 06-02-2014, 10:41 PM
  5. Replies: 4
    Last Post: 09-17-2012, 02:15 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