+ Reply to Thread
Results 1 to 6 of 6

restricting date text box between certain dates

  1. #1
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Ky
    MS-Off Ver
    Excel 2013
    Posts
    344

    restricting date text box between certain dates

    My userform uses a date picker, so all dates entered in the text box "txtsumfrom" will be in (USA) short date format. I had code to allow blanks, and to ensure the value was in date format (in case they wrote over the dater picker) - but I also want to add a rule that the entered date could not be before a certain date (in this case, 7/1/14) or a future date). So I added the code highlighted below. I don't get an error (yay me, I'm learning!), but it doesn't work either!

    I also need to know what code to not allow the dates. As is, it just is suppose to give the message box, but will still allow the forbidden date value. Any help is greatly appreciated!

    Please Login or Register  to view this content.
    -HeyInKy

  2. #2
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: restricting date text box between certain dates

    Why not use mindate property of datepicker control?
    If you are pleased with a member's answer then use the Star icon to rate it.

  3. #3
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Ky
    MS-Off Ver
    Excel 2013
    Posts
    344

    Re: restricting date text box between certain dates

    Quote Originally Posted by buran View Post
    Why not use mindate property of datepicker control?
    I could try, but A) I didn't write the code for the date picker (downloaded from the internet) - too complex for my current skill level, and kind of afraid to mess too much with it; and B) still doesn't address the problem if the enduser types the date manually and does not use the date picker.

  4. #4
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: restricting date text box between certain dates

    You can set mindate during design phase, not in the code. It doesn't' matter if user types the date manually - it's still not allowed.

  5. #5
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: restricting date text box between certain dates

    I read your post for second time. Do you really use DatePicker control or you expect user to enter date in a TextBox control? Note that these are two different types of controls and if you are using textbox, then my suggestion is not correct.

  6. #6
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Ky
    MS-Off Ver
    Excel 2013
    Posts
    344

    Re: restricting date text box between certain dates

    Quote Originally Posted by buran View Post
    I read your post for second time. Do you really use DatePicker control or you expect user to enter date in a TextBox control? Note that these are two different types of controls and if you are using textbox, then my suggestion is not correct.
    Perhaps I misspoke... I'm using a text box with a date picker form that the enduser has the option of using. I don't know for sure, but my guess is that about half of the users will type manually because its quicker than reaching for the mouse, but I suspect many of the slower typers and those not used to tabbing through a form will use the date picker form, activated by a small command button placed next to the date text box.

    My fault for not being too clear on that.

+ 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] Restricting format of date to text
    By sourabh1201 in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 07-01-2013, 12:43 PM
  2. Restricting Specific Dates in any Given month
    By paxile2k in forum Excel General
    Replies: 11
    Last Post: 07-23-2009, 08:40 PM
  3. Restricting Text
    By nadiaz in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-15-2007, 04:25 PM
  4. Restricting copied text to one Column
    By Viking in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-30-2006, 09:30 AM
  5. Restricting Cell Entries to Text Only
    By ExcelTip in forum Tips and Tutorials
    Replies: 0
    Last Post: 08-23-2005, 03:26 AM

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