+ Reply to Thread
Results 1 to 4 of 4

Textbox (Working with Dates)

  1. #1
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,177

    Textbox (Working with Dates)

    This is for a VBA TextBox (Not Worksheet).
    I have two text boxes, both are going to have dates.
    Textbox1 a user will enter a date; example 10/22/08 or 10-22-08 or 10-22-2008 etc, TextBox2 will get that date and add seven days.

    How do I do that?
    This obviously did not work.
    Please Login or Register  to view this content.
    Last edited by Rick_Stanich; 10-22-2008 at 05:25 PM.
    Regards

    Rick
    Win10, Office 365

  2. #2
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Hi Rick. Try:

    Please Login or Register  to view this content.
    CDate converts the TextBox1 value (which is a string) into a date before adding 7 days.

    HTH

    Jason

  3. #3
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,177
    Thank you Jason, I need to remember formatting.

  4. #4
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    No problem Rick. The formatting really didn't have anything to do with your problem, although I thought I would throw that in there. Your issue was you were trying to add 7 to a string (text), rather than a date. A text box always returns a string, so you need to convert it (hence the use of CDate).

    Jason

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1