Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Weekday validation


Message #1 by "Rick Dolson" <rick.dolson@n...> on Mon, 20 Aug 2001 17:50:36
Does anyone know of a formula to put in the validation rule property in a 

table in which it will restrict dates entered into the table to only 

accept dates which are weekdays?

Thank you for any help you can give me.
Message #2 by "Pardee, Roy E" <roy.e.pardee@l...> on Mon, 20 Aug 2001 11:20:38 -0700
You can do this in the table-level validation rule, using an expression

like:



Weekday([MyDate]) Not In (1,7)



Where [MyDate] is the name of your date field.  Using the TLV for this sort

of thing can get cumbersome, especially if you need to check three or four

other things...  but I don't know any cure for that.  You can of course also

do this sort of validation on a form w/a custom VBA function that returns a

boolean.



HTH,



-Roy



P.S. For sample code using a custom function to validate a form control, see



http://support.microsoft.com/support/kb/articles/Q210/3/85.ASP







-----Original Message-----

From: Rick Dolson [mailto:rick.dolson@n...]

Sent: Monday, August 20, 2001 10:51 AM

To: Access

Subject: [access] Weekday validation





Does anyone know of a formula to put in the validation rule property in a 

table in which it will restrict dates entered into the table to only 

accept dates which are weekdays?

Thank you for any help you can give me.
Message #3 by "Darron Michael" <darron.michael@h...> on Mon, 20 Aug 2001 19:44:46
Weekday([dayname],7)>2
Message #4 by "Rick Dolson" <rick.dolson@n...> on Mon, 20 Aug 2001 20:04:14
> Thank you Roy, that worked perfectly.

---------------------------------------------------------------------------

You can do this in the table-level validation rule, using an expression

> like:

> 

> Weekday([MyDate]) Not In (1,7)

> 

> Where [MyDate] is the name of your date field.  Using the TLV for this 

sort

> of thing can get cumbersome, especially if you need to check three or 

four

> other things...  but I don't know any cure for that.  You can of course 

also

> do this sort of validation on a form w/a custom VBA function that 

returns a

> boolean.

> 

> HTH,

> 

> -Roy

> 

> P.S. For sample code using a custom function to validate a form control, 

see

> 

> http://support.microsoft.com/support/kb/articles/Q210/3/85.ASP

> 

> 

> 

> -----Original Message-----

> From: Rick Dolson [mailto:rick.dolson@n...]

> Sent: Monday, August 20, 2001 10:51 AM

> To: Access

> Subject: [access] Weekday validation

> 

> 

> Does anyone know of a formula to put in the validation rule property in 

a 

> table in which it will restrict dates entered into the table to only 

> accept dates which are weekdays?

> Thank you for any help you can give me.

  Return to Index