title: VB6: validating date with a certain format
body: <p>I have built a form using Visual Basic 6. Everything goes great, the form inserts the data in my database and no problems here at all.</p>
  
  <p>Now I need to validate the date field, I need the dates entered to have this format: dd/mm/yyyy</p>
  
  <p>I'm doing: </p>
  
  <pre><code>Private Sub txtMyText_Validate(Index As Integer, Cancel As Boolean)
  If IsDate(Format$(txtMyText(9).Text, "dd/mm/yyyy")) Or txtMyText(9).Text = "" Then
  txtMyText(9).SetFocus
  Else
  txtMyText(9).SetFocus
  MsgBox "Please enter a valid date with this format: dd/mm/yyyy."
  End If
  End Sub
  </code></pre>
  
  <p>But this code is not working.  When I enter a date with this format dd/mm/yy the flow follows to the inserting function and I get an error there cause it is not a dd/mm/yyyy.</p>
  
  <p>Can you please help me  to fix this code? </p>
  
  <p>Thanks a lot!   </p>