Validate Text Date with Sub-Procedure ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a 6 position text field that has 3 areas of interest.
Positions 1 & 2 of this field must be limited to value between 01 and 12 for
month of year.
Position 3 & 4 must be a specific value from list
(01,11,12,13,14,15,16,18,21,22,23,24,26,28,29,31,32,34,35,41,42,44,45,52)
position 5 & 6 must be between 01 and 99.

short of redesigning the table and having 3 separate fields (validating via
validation rule on each), is there a way to validate three separate areas of
1 text field, and if invalid, kick back an input error message and not let
the record pass?

Thanks in advance...
 
You could do it with a table-level validation rule, but it's extremely ugly
....

(Left$([TestText],2) Between "01" And "12") And (Mid$([TestText],3,2) In
("01","11","12","13","14","15","16","18","21","22","23","24","26","28","29","31","32","34","35","41","42","44","45","52"))
And (Mid$([TestText],5,2) Between "01" And "99")

.... I'd go with the three fields if at all possible.

(To create a table-level (not a field-level) validation rule, open the table
in design view and choose 'Properties' from the 'View' menu.)
 
Back
Top