mo3ld@msn.com (Mary) wrote in message news:<cfcb70e4.0311031139.d8ac5ae@posting.google.c om>...[color=blue]
> I have an online form that users fill out and upon submission the data
> goes to an MS access database on our server.
>
> One of the fields asks for the date a student needs to take an exam.
> The students know they should only use the online form if they are
> scheduling at least 2 weekdays ahead of time, however, the form
> doesn't currently have a way to reject a submission that breaks the 2
> day rule.
>
> Can anyone help me with a query where the data in the date field is
> compared to the current date and accepted or rejected based on the
> 'Must schedule at least 2 WEEKDAYS ahead of time' rule?[/color]
there's a weekday math function available at
www.mvps.org/access
only problem is that you're going to have to rewrite that in VBScript
if you want it to work on your web page, because if you were doing it
on a form, you'd do it in the BeforeInsert event of the form, and
since you're talking directly to teh database engine, you wouldn't
have that event to help you. You'd have to modify the code for your
Submit button to do the checking for you and if it failed reject the
insertion... Something like
Sub cmdSubmit()
If WeekdayDiff(dtScheduleDate,dtCutoffDate)<2 Then
Response.Write("Sorry, need to workdays lead time!")
Else
'write the record to the database...
End if
End Sub