How do I setup a date field property that allows only Saturdays?

J

jaymalea

For example:

03/13/2010 would be fine, as that is a Saturday. 03/12/2010 would return an
error message as it is a Friday.

How would I create a field property for this, or would I use a different
aspect of Access creation?
 
P

PieterLinden via AccessMonster.com

jaymalea said:
For example:

03/13/2010 would be fine, as that is a Saturday. 03/12/2010 would return an
error message as it is a Friday.

How would I create a field property for this, or would I use a different
aspect of Access creation?

Private Sub txtSaturday_BeforeUpdate(Cancel As Integer)
If Not Weekday(Me.txtSaturday) = vbSaturday Then
MsgBox "Not a Saturday!"
Cancel = True
End If
End Sub
 
A

Allen Browne

Open the table in design view, select the Date/Time field, and set these
properties:
- Validation Rule: ([SatOnly] Mod 7)=0
- Validation Text: Must be a Saturday

Replace the SatOnly with the name of your field.
 
J

Jim Yohe

Excellent. This solution worked for me. Thanks.
For example:

03/13/2010 would be fine, as that is a Saturday. 03/12/2010 would return an
error message as it is a Friday.

How would I create a field property for this, or would I use a different
aspect of Access creation?
On Friday, March 12, 2010 12:52 AM Allen Browne wrote:
Open the table in design view, select the Date/Time field, and set these
properties:
- Validation Rule: ([SatOnly] Mod 7)=0
- Validation Text: Must be a Saturday

Replace the SatOnly with the name of your field.
 

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