Quote Originally Posted by fadi_r
hi

you can use this code

VB Code:
  1. Private Sub Text1_LostFocus()
  2. Text1.Text = Format(Text1.Text, "dd/mm/yy")
  3. End Sub
  4.  
  5. ()
Fadi_r,

Using your code try entering the following value into Text1: 010101
You will see that the function returns: 27/08/1927

It returns 27/08/1927 because then this date is 10,101 days greater that 30/12/1899 which I believe is the base date that windows uses to determine the date.

But if you enter 01/01/01 or 01/0/2001 then it will return 01/01/2001.

But I agree with the others a Datepicker is the way to go!