469,572 Members | 1,243 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,572 developers. It's quick & easy.

MS Access form collects data on internet

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?
Nov 12 '05 #1
3 3214
Tom
Mary,

Would you be better served in creating a Validation Rule for the date rather
than using a query to reject the date?

Request:
Could you give me the details of how to create an on-line form or where to look
for information on how to do it. Then I am particularly interested in the
details of how to get the data ito an Access database after it is submitted.

Thanks!

Tom
"Mary" <mo***@msn.com> wrote in message
news:cf*************************@posting.google.co m...
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?

Nov 12 '05 #2
something you could try in your connect to Access ASP would be:

<%
...
d = Request.Form("Datefld")
If WeekDay(Date) = 6 Then 'Friday
If d > DateAdd("d", 4, Date) Then 'greater than Monday
Response.Write("Date entered is past the 2 day limit!")
Else
strConnect = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("\Students.mdb")
End If
End If
If WeekDay(Date)>= 2 Or WeekDay(Date)<=4 Then
If d > DateAdd("d",2,Date) Then
Response.Write("Date entered is past the 2 day limit!")
Else
strConnect = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("\Students.mdb")
End If
End If
...
%>

This isn't real sophisticated, but it is just to give you some ideas -
using If Then with Date Functions, if the submitter meets the criteria,
you write the data, if not, don't write the data.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #3
mo***@msn.com (Mary) wrote in message news:<cf*************************@posting.google.c om>...
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?


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
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Bob | last post: by
3 posts views Thread by Lyle Fairfield | last post: by
9 posts views Thread by Wayne Smith | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.