Results 1 to 20 of 27

Thread: UserForm to Return the MAX date in a TextBox resulting from VLOOKUP in ComboBox

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,709
    Location
    I made the changes and now I am no loner getting the errors but it also is not pulling in any date in the ApptDateTextBox.
    Arrgh!

    When you see what that code is doing, you will see the answer.

    What this should do is give what the next appointment date would be after finding the future date already entered on the worksheet then adding the interval entered in weeks.
    Dim NextAppDate As Date
    
    If TextBoxOther = "" Them
       NextAppDate = maxDate
    Else
       NextAppDate = DateAdd(MaxDate, ww, Clng(TextBoxOther)
    End If
    If you see what that code does, then you can find the hint, the typo, and the error in it by yourself. One each.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  2. #2
    VBAX Regular
    Joined
    Jun 2005
    Posts
    95
    Location
    Quote Originally Posted by SamT View Post
    Arrgh!

    When you see what that code is doing, you will see the answer.



    Dim NextAppDate As Date
    
    If TextBoxOther = "" Them
       NextAppDate = maxDate
    Else
       NextAppDate = DateAdd(MaxDate, ww, Clng(TextBoxOther)
    End If
    I tried this but entering a number in the other TextBox does not advance the date in ApptDateTextBox. What I want it to do is take the number that is entered in WeeklyIntervalTextBox and multiply it by 7 then add it to the date that was returned. By doing this, as an example, if 11/1/2019 is returned in ApptDateTextBox and "4" is entered in WeeklyIntervalTextBox then I want to take the "4" and multiply it by 7 (for days in the week, which would be 28) then add that 28 to the date returned in ApptDateTextBox which would give a final result of 11/29/2019. Also out of curiosity, what is the "ww" and "Clng"? Thank you for your help.

    NextAppDate = DateAdd(MaxDate, ww, Clng(weeklyintervaltextbox)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •