From: jaymalea on
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?
From: PieterLinden via AccessMonster.com on
jaymalea wrote:
>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

--
Message posted via http://www.accessmonster.com

From: Allen Browne on
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.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"jaymalea" <jaymalea(a)discussions.microsoft.com> wrote in message
news:A0A534FE-E315-4E60-979C-35BBF20B21F2(a)microsoft.com...
> 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?

From: John W. Vinson on
On Thu, 11 Mar 2010 18:44:01 -0800, jaymalea
<jaymalea(a)discussions.microsoft.com> wrote:

>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?

Might it not be better to have the textbox just adjust itself to the next (or
previous) Saturday instead? You can use DateAdd() in the textbox's afterupdate
event to reset the date:

Private Sub txtSaturday_AfterUpdate()
If Weekday(Me!txtSaturday) <> vbSaturday Then
Me!txtSaturday = DateAdd("d", 7 - Weekday(Me!txtSaturday))
MsgBox "Adjusted date to Saturday, " & format(Me!txtSaturday, "dd-mmm-yyyy")
End If
End Sub
--

John W. Vinson [MVP]