+ Reply to Thread
Results 1 to 7 of 7

USERFORM Returning Wrong Date format when seaching table record

  1. #1
    Registered User
    Join Date
    12-06-2020
    Location
    Essex
    MS-Off Ver
    365
    Posts
    29

    USERFORM Returning Wrong Date format when seaching table record

    Can someone help please?

    I have a userform for updating my table with various date fields in textboxes, when the data is transferred to the table i am using CDate to ensure the correct format "dd/mm/yyyy" is transferred, which is all working fine, however, my problem is i have a command button to search the table and return a record from the table back to the userform, this is where the incorrect date is coming back as "m/d/yyyy" this is my search code below, can someone suggest an edit so I can return the correct date format back to the userform. Ive underlined the date fields.

    Please Login or Register  to view this content.
    Last edited by Chrisb812; 12-28-2020 at 06:18 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,830

    Re: USERFORM Returning Wrong Date format when seaching table record

    Administrative Note:

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    12-06-2020
    Location
    Essex
    MS-Off Ver
    365
    Posts
    29

    Re: USERFORM Returning Wrong Date format when seaching table record

    Sorry about that, i didn't realise, I've updated with tags as requested.

    Regards
    Chris

  4. #4
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: USERFORM Returning Wrong Date format when seaching table record

    Does this approach work?

    Please Login or Register  to view this content.
    If not, feel free to attach a desensitized version of the workbook and we can tinker around with it to find a solution.

    BSB

  5. #5
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: USERFORM Returning Wrong Date format when seaching table record

    And Maybe
    Please Login or Register  to view this content.

  6. #6
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: USERFORM Returning Wrong Date format when seaching table record

    Try by adding a coded change_event to your TextBox
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    12-06-2020
    Location
    Essex
    MS-Off Ver
    365
    Posts
    29

    Re: USERFORM Returning Wrong Date format when seaching table record

    Quote Originally Posted by BadlySpelledBuoy View Post
    Does this approach work?

    Please Login or Register  to view this content.
    If not, feel free to attach a desensitized version of the workbook and we can tinker around with it to find a solution.

    BSB

    Thank you everyone for your input, BSB your code is perfect, thank you so much for your help.

    Regards
    Chris

+ 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] Double click in listbox returning wrong value for date
    By Rocky01 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-21-2019, 04:37 AM
  2. [SOLVED] Record macro on filtering date, wrong result after running the macro
    By karmapala in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-16-2019, 05:32 AM
  3. Date Value is Show Wrong in Know Intrest Userform
    By svgopalareddy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-13-2016, 07:09 PM
  4. [SOLVED] Seaching for last date that meets requirements
    By Befuddled in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 09-04-2015, 02:21 AM
  5. Wrong Date Format in output userform
    By ABBOV in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-28-2010, 06:58 AM
  6. Web Query returning wrong time but right date
    By sean13128 in forum Excel General
    Replies: 0
    Last Post: 04-01-2010, 03:38 PM
  7. seaching for info between dates in a table
    By wassonc in forum Excel General
    Replies: 6
    Last Post: 08-21-2009, 11:47 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