View Single Post
  #4  
Old March 12th, 2010, 06:24 AM posted to microsoft.public.access.tablesdbdesign
John W. Vinson
external usenet poster
 
Posts: 18,261
Default How do I setup a date field property that allows only Saturdays?

On Thu, 11 Mar 2010 18:44:01 -0800, 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?


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]