blh3213 said:
I need to have the date and time entered on the form (05/05/05 13:00
PM). Any suggestions on a validation rule that will force both the
date and time to be input?
Thanks for any suggestions you may have.
If the time could conceivably be midnight, then I don't think you can do
this with a validation rule as such, because validation rules are
value-based, and there is no difference in value between "05/05/05 12:00
AM", "05/05/05 00:00", and "05/05/05". I imagine you could test the
..Text property of the control to make sure that both a date portion and
a time portion were entered, provided that you do it in an event in
which the control still has the focus.
If midnight is not an acceptable value for the time portion of the
date/time field, then you can use a validation rule. Maybe something
like this will do:
(Fix([TheField])<>0) And (Abs([TheField])-Abs(Fix([TheField]))<>0)
If dates must be on or after 12/31/1899, and midnight is not a valid
time, then you can simplify the above rule to
([TheField] > 1) And ([TheField] - Fix([TheField]) <> 0)
I haven't really tested this all out thoroughly, but I think something
like that should work.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)