Compare date in form with date/time in form with date/time in database 
Author Message
 Compare date in form with date/time in form with date/time in database

I was just wondering there is an easy way to compare a date submitted
from a from with a date already in my database.  I have tried to
convert the Date which is a variant to Date Format but I am not getting
the response that I need.  date1 is a Short Date in my Access database.

Any suggestions.

Here is the VB Script
<%
dim objDB
dim sSql
dim rsCal
dim oRs

dim subDate1
dim subEvent
dim subTime1
dim subVenue
dim subComments

subDate1 = Request.Form ("Date")
subEvent = Request.Form ("Event")
subTime1 = Request.Form ("Time")
subVenue = Request.Form ("Venue")
subComments = Request.Form ("Comments")

Response.buffer = "True"

set objDB=Server.CreateObject("ADODB.Connection")
objDB.Open "f1999g01"
objDB.BeginTrans
set rsCal=Server.CreateObject("ADODB.Recordset")

rsCal.Open "EventLog", objDB, adOpenForwardOnly, adLockOptimistic,
adCmdTable

sSql = "Select * From EventLog where date1 =" &CDate(subDate1)&" ;"
set oRs = objDB.Execute (sSql)

if isNull(oRs) then
     If subDate1 <> "" and subEvent <> "" and subTime1 <> "" and
subVenue <>
""  Then

          rsCal.AddNew
          rsCal("date1") = CDate(subDate1)
          rsCal("event") = subEvent
          rsCal("time1") = CDate(subTime1)
          rsCal("venue") = subVenue
          rsCal("comments") = subComments
          rsCal.Update

          Response.redirect("addSucCal.asp")
     else
          Response.redirect("CalIncorrect.asp")
     End if
else
     Response.redirect("addUnsucCal.asp")
'No matter what I do I am always redirected to this page
end if

rsCal.Close
objDB.Close

%>

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Sat, 11 May 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. start date/time, end date/time problem

2. Matching system date/time with field date/time

3. combining a time and a date to one Date/Time value

4. How to subtract a date-time from a date-time

5. ADO with Access Date/Time field not storing the time, just the date

6. Converting %date% %time% to VB Time/Date

7. Date/Time forms validation

8. Outlook 2000 Custom Form using Date Time Picker Control

9. Date/Time to date

10. Extracting the date out of a Date/Time field

11. Date part of Date/Time Field

12. Date/Time picker and calculating date differences

 

 
Powered by phpBB® Forum Software