+ Reply to Thread
Results 1 to 4 of 4

Userform Textboxes and dates

  1. #1
    Registered User
    Join Date
    05-20-2013
    Location
    Kegworth, England
    MS-Off Ver
    Excel 2019
    Posts
    58

    Userform Textboxes and dates

    Hi All,
    I have a multi-page userform that, 1. Is used to populate information entered into a data sheet, and
    2. Receive data from the data sheet and place in a list-box and, placing a row of data in various textboxes on the userform in order search, edit or delete the previously selected information.
    When entering dates, e.g. date of birth or date of admission, the appropriate dates are entered from the userform into the data sheet correctly, in the required format, dd mmm yyyy. When re-calling data the dates are shown in the userform's list-box in the correct format - dd mmm yyyy, but
    when calling (double-clicking) on data in the userform list-box in order to edit the information, the list-box data is placed in the relevant text-boxes ready for editing again correctly however, when the dates in the list-box are transferred they appear in the textboxes as a date in "general" format i.e. 9238 instead of 16 Apr 1925.

    I have looked at and tried many examples from various examples but to no avail. Does anyone know how I can force a text-box to accept a dd mmm yyyy format?

    Thank you in anticipation of any help given.

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Userform Textboxes and dates

    TextBoxes do not have a format.

    What is the ListBox Double Click event code that transfers the double clicked item from the ListBox to the Text Box?
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,414

    Re: Userform Textboxes and dates

    Quote Originally Posted by AndyRoo119 View Post
    Hi All,
    I have a multi-page userform that, 1. Is used to populate information entered into a data sheet, and
    2. Receive data from the data sheet and place in a list-box and, placing a row of data in various textboxes on the userform in order search, edit or delete the previously selected information.
    When entering dates, e.g. date of birth or date of admission, the appropriate dates are entered from the userform into the data sheet correctly, in the required format, dd mmm yyyy. When re-calling data the dates are shown in the userform's list-box in the correct format - dd mmm yyyy, but
    when calling (double-clicking) on data in the userform list-box in order to edit the information, the list-box data is placed in the relevant text-boxes ready for editing again correctly however, when the dates in the list-box are transferred they appear in the textboxes as a date in "general" format i.e. 9238 instead of 16 Apr 1925.

    I have looked at and tried many examples from various examples but to no avail. Does anyone know how I can force a text-box to accept a dd mmm yyyy format?
    You have not given us any code to work with, so a general type answer... take the value from the ListBox and pass it through the Format function. So, if your ListBox was named ListBox1 and your TextBox was named TextBox1, then something along the lines of this should work...

    TextBox1.Value = Format(ListBox1.Value, "dd mmm yyyy")

  4. #4
    Registered User
    Join Date
    05-20-2013
    Location
    Kegworth, England
    MS-Off Ver
    Excel 2019
    Posts
    58

    Re: Userform Textboxes and dates

    Hi Rick,

    Did like you said and my relevant bit of code now reads;

    Please Login or Register  to view this content.
    Works great, thanks.

    Now going to try and work out how to validate the dates being entered.

    Watch this space!

+ 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] Assigning value to all textboxes in UserForm
    By ChemistB in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-09-2015, 12:18 PM
  2. Chronological Dates In TextBoxes On UserForm
    By yoshi_5 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-29-2015, 09:35 AM
  3. keypress for all textboxes in userform
    By leprince2007 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 05-10-2015, 06:23 AM
  4. Help Populating Textboxes in Userform, With Multipage Userform.
    By mdmorgan24 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-07-2012, 05:29 PM
  5. How to tab or enter between textboxes not in userform
    By cuewoz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-02-2009, 03:10 AM
  6. Userform TextBoxes
    By tqm1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-29-2007, 09:04 AM
  7. UserForm TextBoxes
    By Rob in forum Excel General
    Replies: 2
    Last Post: 08-05-2005, 10:07 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