limit date input to a sunday date in access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can I limit a date input on a form to be only a Sunday date in the year? if
So could you show me how? thank you I am using office professional 2003
with access 2033 as the data base.
 
On the before update event of the field you can write the code

If WeekDay(Me.[DateFieldName]) <> 1 Then
MsgBox "Must be Sunday"
Cancel = True 'wont let the user continue
End If
 
i am sorry but I must be doing something wrong because I keep getting syntax
errors. It suggestes that I hane added and operater with out operand Could
you please expand thankyou
RLM

Ofer said:
On the before update event of the field you can write the code

If WeekDay(Me.[DateFieldName]) <> 1 Then
MsgBox "Must be Sunday"
Cancel = True 'wont let the user continue
End If
--
\\// Live Long and Prosper \\//
BS"D


richglass said:
Can I limit a date input on a form to be only a Sunday date in the year? if
So could you show me how? thank you I am using office professional 2003
with access 2033 as the data base.
 
Can you post the code you have?

--
\\// Live Long and Prosper \\//
BS"D


richglass said:
i am sorry but I must be doing something wrong because I keep getting syntax
errors. It suggestes that I hane added and operater with out operand Could
you please expand thankyou
RLM

Ofer said:
On the before update event of the field you can write the code

If WeekDay(Me.[DateFieldName]) <> 1 Then
MsgBox "Must be Sunday"
Cancel = True 'wont let the user continue
End If
--
\\// Live Long and Prosper \\//
BS"D


richglass said:
Can I limit a date input on a form to be only a Sunday date in the year? if
So could you show me how? thank you I am using office professional 2003
with access 2033 as the data base.
 
Sunday date

=?Utf-8?B?cmljaGdsYXNz?= said:
Can I limit a date input on a form to be only a Sunday date in the year? if
So could you show me how? thank you I am using office professional 2003
with access 2033 as the data base.

The DATEPART function is useful;
Usage: DATEPART(w, date) returns 1 - 7 with 1 being a Sunday.
Hope this helps.
Good luck!
 

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

Back
Top