Mask Edit Box - VB6 - Tab Key Press Action

I've got a data entry form in my app.  The first field is a mask edit box called mskDate, and it's set up like such in the Form Activate procedure:

    mskDate.Mask = "##/##/##"

I want to make it so when the user presses the Tab key when the focus is in this field, that the current date will be assigned to the control's text property.  Since Tab, as far as I know, only responds to the KeyPress Event, I tried the following which does not work:

If KeyAscii = vbTab Then mskDate.Text = Format(Now, "mm/dd/yy")

I also tried Format(Date, "mm/dd/yy") and (Date, "##/##/##")

No luck.  The tab just goes to the next textbox in the tab order.  Any words of wisdom would be greatly appreciated.

Who is Participating?
VbmasterConnect With a Mentor Commented:
Does the masked edit box have a LostFocus() event? Maybe that will work with Tab..
ljklinskyAuthor Commented:
The masked edit control does have a LostFocus() event, but the Tab key is apparently only recognized in the KeyPress event.  LostFocus doesn't respond to KeyAscii lines of code.
ljklinskyAuthor Commented:
The LostFocus event responded to:

If mskDate.Text = "__/__/__" Then mskDate.Text = Format(Date, "mm/dd/yy")

All Courses

From novice to tech pro — start learning today.