MaskEdBox, format and lostFocus

jbenezech

Registered User.
Local time
Today, 15:43
Joined
Jun 23, 2006
Messages
13
Hi All,

I have forms with fields such as date and telephone number. I want to use Input Masks and formats to help the user type the data and to control the display.
This works great with normal text boxes but I could not figure out how to get control over the message that is displayed when the data is invalid for the mask (I don't want the default Access message, I want a custom popup).

So I decided to use the MaskEdBox control. This is great to customize the message but seems to behave strangely when it comes to masks and formst.

Example on a date field:

- the input mask is ##/##/##99 to allow the user to enter the year on either 2 or 4 digits
- the format is dd/mm/yyyy to always display the year on 4 digits format
- I want the user to type "01/01/06" and the control to display "01/01/2006"

problems:

1) When the user type "01/01/06" and leaves the field, the data is not formated and it still displays "01/01/06__"

2) If I format myself the field in the code on the lostFocus event, the field is then displayed correctly but the focus stays on the date field. So if the user enters the date, then TAB, the focus is still on the date field. If the user TAB twice, the focus leaves the field.

3) If I write the same format code on the exit event of the field, the focus never ever leaves the date field.


Questions:

1) Can I do that with a simple TextBox ? How to I stop the Access Mask Validation Failed message and use my own ?

2) How to I get the MaskEdBox control to format the date when the user leaves the field

Cheers,
Jerome
 

Users who are viewing this thread

Back
Top Bottom