Hello everyone.
I am creating a website that contains an events list. The events have 5 fields: Title, Location, Description, Start, and End date. If the event is only one day, the user leaves the end date field blank (and the rest of the site does the rest). Here's my problem.
If the user creates an event, and then goes back to edit it, the submission script is supposed to tell whether the end date field is left blank or not. If it was
not left blank, it is supposed to take the end date field, and overwrite what was already there. If it
was left blank, another query string will make it null. Here's my scripting.
Code:
<%
if(Session("UserID")==null)
Response.Write("Administrative access only. Please redirect to the login page.");
else
{
var EventID=Number(Request.Form("EventID"));
var Title=String(Request.Form("Title"));
var Location=String(Request.Form("Location"));
var Body=String(Request.Form("Body"));
var Start=Request.Form("Start");
var Stop=Request.Form("End");
var PageRedirect;
if(Title.ActualSize==0 || Body.ActualSize==0 || Start.ActualSize==0)
{
Response.Write("The creation of your event could not be completed because a field was left blank.");
PageRedirect="EventAdd.asp";
%><!--#INCLUDE file="Includes/Redirect.inc"//--><%
}else
{
if(Stop!=null)
Application("CBEA").Execute("UPDATE [Events] SET Events.evTitle="+fixApostrophes(Title)+", Events.evLocation="+fixApostrophes(Location)+", Events.evDescription="+fixApostrophes(Body)+", Events.evStart=#"+Start+"#, Events.evEnd=#"+Stop+"# WHERE [Events].[evID]="+EventID);
else
Application("CBEA").Execute("UPDATE [Events] SET Events.evTitle="+fixApostrophes(Title)+", Events.evLocation="+fixApostrophes(Location)+", Events.evDescription="+fixApostrophes(Body)+", Events.evStart=#"+Start+"#, Events.evEnd=null WHERE [Events].[evID]="+EventID);
Response.Write("Your event has been successfully posted to the events list.");
PageRedirect="EventView.asp";
%><!--#INCLUDE file="Includes/Redirect.inc"//--><%
}
}
%>
The error I am getting is this:
Code:
Microsoft JET Database Engine- Error '80040e07'
Syntax error in date in query expression '##'.
E:\CBEA\Inetpub\Admin\EventEdit_action.asp, line 56
Although that is the error I am getting, the real error is in the if-then-else statement. If the field was left blank (like the error is saying) then it should be going to the else query string, but it's not. Any ideas?