please help me on date validation

B

bob

I'm doing a hotel booking assignment and need help on date validation. The
thing that I am stuck on is that the hotel is closed between December 22nd
until the January 7th and I need to be able to block these dates out so that
rooms cannot be booked and also how do I make the last year bit so it
becomes a wildcard I have something like
#12/12/04 #or <#7/1/05 #

but the I don't know how I could make the years a wildcard so it would work
for any year

any help much appreciated
 
W

Wayne Morgan

This validation would probably be much easier in the BeforeUpdate event of
the control on the form. You could then use VBA to get the current year and
manipulate the dates as needed.
 
J

John Vinson

I'm doing a hotel booking assignment and need help on date validation. The
thing that I am stuck on is that the hotel is closed between December 22nd
until the January 7th and I need to be able to block these dates out so that
rooms cannot be booked and also how do I make the last year bit so it
becomes a wildcard I have something like


but the I don't know how I could make the years a wildcard so it would work
for any year

any help much appreciated

Wayne's suggestion is well taken - but note that literal date values
MUST be in American mm/dd/yy format (or an unambiguous format such as
yyyy-mm-dd or 12-Dec-2004).

If you want to block out from December 12 of the current year through
January 7 of next year, use

Not Between DateSerial(Year(Date()), 12, 12) AND
DateSerial(Year(Date()) + 1, 1, 7)


John W. Vinson[MVP]
 
Top