View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
tkraju via OfficeKB.com tkraju via OfficeKB.com is offline
external usenet poster
 
Posts: 109
Default textbox validation with 3 conditions

Mr.Bob, thank you but this code has not given me desired results.I entered in
Textbox1 a date as
04/06/08(means 4th June 2008),it converted to 06-Apr-08(6thApril2008).
what is the remedy?

Bob Phillips wrote:
I would use the AfterUpdate event and just check that it is a date, let them
enter it however they want, and reform at it

Private Sub TextBox1_AfterUpdate()
With Me.TextBox1

If IsDate(.Text) Then

.Text = Format(CDate(.Text), "dd-mmm-yy")
Else

MsgBox "Invalid date entry"
.SelStart = 0
.SelLength = Len(.Text)
.SetFocus
End If
End With
End Sub

thank you Bob.Working fine !
one more question.

[quoted text clipped - 25 lines]
or
corrects the entry by putting exact values as in TextBox1.


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200806/1