input masks and default values

B

bob

I have a form that was created in Access 97 that contains
a field with an input mask (00/00/0000\ 90:00\ >LL;0) and
a default value (=Format(Now(),"mm/dd/yyyy hh:nn
AM/PM")). When changing the field value on the screen in
Access 97, users would receive the input mask diplay. In
Access 2002, for any value the user tries to enter,
the "The value you entered isn't appropriate for the
input mask" error message is received. I found by
removing the default value from the field properties
resolves the user input problem, but this is not an
option. Is there a way to convert the functionality to
Access 2002?
 
J

John Nurick

Hi Bob,

If I were you I'd junk the input mask. They're more trouble than they're
worth in most circumstances.

If this is a date/time field, you can normally rely on the field's
built-in ability to parse the correct value out of a variety of user
input (e.g. "1/1/03 0900" or "Jan 1, 2003 9AM" work just as well as
"01/01/2003 9:00 AM". If necessary, give the user a prompt ("Enter date
mm/dd/yyyy and time") and/or use VBA code in the control's BeforeUpdate
event to ensure that the user has typed an appropriate value.

Use "mm/dd/yyyy hh:nn AM/PM" in the field's and textbox's Format
property.

If it's a text field, then (a) consider using date/time instead, and (b)
write code in the BeforeUpdate event that converts it to a date/time
(using the CDate() function), validates it, and then converts it back to
text (using Format()).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top