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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Does the masked edit box have a LostFocus() event? Maybe that will work with Tab..

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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")

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.