Announcement

Collapse
No announcement yet.

Adding days to date

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Adding days to date



    I have two text boxes on a userform one you manually enter the date and the other automatically calculates the date 28 days in advance. This works until you try and change the date in the manual text box then I get a Type Mismatch error

    Can anyone help please

    Code as follows:

    Code:
    Private Sub GTW_Date_txt_Change()
    
    RefGTW_Date_txt = CDate(GTW_Date_txt) + 28
    
    End Sub
    Thanks
    Last edited by Miss KF; April 12th, 2006, 19:23.

  • #2
    Re: Adding days to date

    What about:
    Code:
    RefGTW_Date_txt = CStr ( CDate(GTW_Date_txt) + 28 )
    Cheers, Glenn.

    Beauty is in the eye of the beer-holder.

    Comment


    • #3
      Re: Adding days to date

      Tried your suggestion it still gives me the Type mismatch error

      Thanks

      Comment


      • #4
        Re: Adding days to date

        If you convert the date to a number first you should then be able to add 28 to it, then convert it back to a date, e.g.
        Code:
        CDate(DateValue(GTW_Date_txt) + 28)
        Hope this helps.

        Regards,
        Batman.
        Regards,
        Batman.

        Comment


        • #5


          Re: Adding days to date

          Thanks Batman

          I've added it to the Exit procedure, I think using the Change procedure may also have been causing the problems

          Karen

          Comment

          Working...
          X