+ Reply to Thread
Results 1 to 8 of 8

Change textbox format to date

  1. #1
    Forum Contributor
    Join Date
    08-30-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    141

    Change textbox format to date

    Hi guys

    I have this code

    Please Login or Register  to view this content.
    My question is, how do i change the date format of the textbox to dd/mm/yyyy? because when i type the date 5/10/2012 in the textbox, it will appear 20/5/2012 in the database.

    Thank you.

  2. #2
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: Change textbox format to date

    use format(Me.textbox3.Value,"dd/mm/yyyy")

  3. #3
    Forum Contributor
    Join Date
    08-30-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    141

    Re: Change textbox format to date

    Hi Sindhus

    Thanks for your reply but when i put the code that u give, it doesnt function. Its shows compile error.

  4. #4
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: Change textbox format to date

    can you attach your workbook?

  5. #5
    Forum Contributor
    Join Date
    08-30-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    141

    Re: Change textbox format to date

    Hi Sindhus

    I already attach a simple dummy file. Whenever i put the date in the format dd/mm/yyyy in the textboxt, it will appear in the database in format mm/dd/yyyy. Hope you can help me. Thank you
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: Change textbox format to date

    You can format the D column to DD/MM/YYYY format before running the code. Or try this code.
    Please Login or Register  to view this content.

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Change textbox format to date

    You can use either DateValue or CDate:
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    08-30-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    141

    Re: Change textbox format to date

    Hi Sindhus and Norie. Thanks a lot! both of your codes can be used!

+ 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