+ Reply to Thread
Results 1 to 10 of 10

How to update Text Box with date 14 days after selected date...

  1. #1
    Registered User
    Join Date
    01-24-2014
    Location
    Los Angeles
    MS-Off Ver
    Excel 2003
    Posts
    9

    How to update Text Box with date 14 days after selected date...

    So I am creating a form that that has two text boxes. I have them both set to Short Date as their format. I am trying to make it so that When a date is selected in the first text box, the second text box will automatically fill out the date of the first text box PLUS 14 days, WITHOUT clicking anywhere. Just an automatic refresh. I have been able to make it so that it will show 14 days later when I click in the text box, but I need this to update automatically after selecting the initial date. Thanks.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: How to update Text Box with date 14 days after selected date...

    Quote Originally Posted by mjc61 View Post
    So I am creating a form that that has two text boxes. I have them both set to Short Date as their format. I am trying to make it so that When a date is selected in the first text box, the second text box will automatically fill out the date of the first text box PLUS 14 days, WITHOUT clicking anywhere. Just an automatic refresh. I have been able to make it so that it will show 14 days later when I click in the text box, but I need this to update automatically after selecting the initial date. Thanks.
    Try something like this...
    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    01-24-2014
    Location
    Los Angeles
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: How to update Text Box with date 14 days after selected date...

    Thanks for the quick response. Unfortunately this did not work . This also made it lose the "clicking in text box2 to update" functionality. However I still have that functionality when I place this under the AfterUpdate function.

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: How to update Text Box with date 14 days after selected date...

    Quote Originally Posted by mjc61 View Post
    Thanks for the quick response. Unfortunately this did not work . This also made it lose the "clicking in text box2 to update" functionality.
    I don't know what that means.

  5. #5
    Registered User
    Join Date
    01-24-2014
    Location
    Los Angeles
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: How to update Text Box with date 14 days after selected date...

    It means that when I placed that code in the _AfterUpdate() function as opposed to the _Click(), it worked the same way as I had it. I am able to click in the second text box to get it to display the date. However, it will not automatically refresh Textbox2 to display the date + 14 days as entered in Textbox1.
    Last edited by mjc61; 01-25-2014 at 07:29 PM.

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: How to update Text Box with date 14 days after selected date...

    Did you try using the _Change procedure as I had written it?

    _AfterUpdate isn't triggered until you click on some other control.

  7. #7
    Registered User
    Join Date
    01-24-2014
    Location
    Los Angeles
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: How to update Text Box with date 14 days after selected date...

    Yes I did try it there first. No luck.

    It's almost like there needs to be a way to refresh Textbox2 from the Textbox1_Change() sub to automatically show the value. I have not found a way to do this.

  8. #8
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: How to update Text Box with date 14 days after selected date...

    Quote Originally Posted by mjc61 View Post
    Yes I did try it there first. No luck.

    It's almost like there needs to be a way to refresh Textbox2 from the Textbox1_Change() sub to automatically show the value. I have not found a way to do this.
    The TextBox1_Change procedure works for me automatically as I type in a date in TextBox1. As soon as a valid date is in TexBox1, TextBox2 shows that date +14

    Perhaps you should comment out any other TextBox1 event procedures?

  9. #9
    Registered User
    Join Date
    01-24-2014
    Location
    Los Angeles
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: How to update Text Box with date 14 days after selected date...

    Quote Originally Posted by AlphaFrog View Post
    The TextBox1_Change procedure works for me automatically as I type in a date in TextBox1. As soon as a valid date is in TexBox1, TextBox2 shows that date +14

    Perhaps you should comment out any other TextBox1 event procedures?
    Ahh ok so I think I see what is happening here. The Textbox2 will update with the correct date once I go back to the first date and begin to change it. For example: I will enter 6/1/2010 in Textbox1 and hit enter. Nothing will happen. But as soon as I start to change any of the date values in Textbox 1, Textbox2 will automatically display 6/15/2010.

    It is like it is one step behind.

    Thanks for all your help, I know I'm close to getting this working correctly!

  10. #10
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: How to update Text Box with date 14 days after selected date...

    Quote Originally Posted by mjc61 View Post
    For example: I will enter 6/1/2010 in Textbox1 and hit enter. Nothing will happen.
    Something should happen with the first entry.

    My guess is you have another event procedure (TextBox 1 or TextBox2) that counteracts the TextBox1_Change procedure.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Text is changed to current date date when row is selected. No idea why?
    By rhug in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 12-10-2013, 02:41 AM
  2. Calculate End Date Using Start Date and No. of Days excluding specific days.
    By SinusxCosinusx in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-22-2013, 05:48 AM
  3. Changing Cell Colour set days before a date and set days after a date.
    By imranrasool in forum Excel Formulas & Functions
    Replies: 24
    Last Post: 04-26-2013, 03:40 AM
  4. excel formula: days remaining=end date-todays date+extention days
    By fsprings in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 01-04-2013, 06:45 AM
  5. Date to update after 7 days Please
    By Steved in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-13-2006, 09:00 PM

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