Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2004
    Posts
    2

    Unhappy Unanswered: HELP!!! Microsoft JET Database Engine (0x80040E14)

    Please help me!!!!

    There is an error says,
    [Microsoft JET Database Engine (0x80040E14)
    Syntax error (missing operator) in query expression
    '','','qqqqq','qqqqqqqqqqq','qqqqqqqqq','None','on ');'.
    /staff2/add-event-2.asp, line 102]

    This is my code:

    Code:
    <!-- Include files  -->
    <!-- #include file="..\include\adovbs.inc" -->
    <!-- #include file="..\include\datastore.inc" -->
    <!-- #include file="..\include\connection.inc" -->
    <!-- #include file="..\include\auth.inc" -->
    <!-- #include file="..\include\functions.inc" -->
    
    <%
    Dim RsEventid, strEventid, strStaffid, strStartDate, strEndDate, strStartTime, strEndTime, strSubject, strDetails, strLocation, strRepeat, strStaffOnly
    Dim dNewDate, dNewEndDate
    
    ' *** Add the new data'
    sSQL1 = "SELECT MAX(eventid) as cid FROM tblcalendar"
    Set RsEventid = oConn.Execute(sSQL1)
    
    if RsEventid("cid") <> 0 then
    	strEventid = RsEventid("cid") + 1
    else
    	strEventid = 1
    End if
    
    ' *** Store the incoming data in variables
    ''strEventid = RsEventid("cid") + 1'
    strStaffid = Request.Cookies("user")("staffid")
    strStartDate = Request.Form("txtStartDate")
    strEndDate = Request.Form("txtEndDate")
    
    
    ' formats the time correctly'
    if Request.Form("txtStartTime") <> "" then
    	strStartTime = Request.Form("txtStartTime") & " " & Request.Form("txtStartTimeType")
    else
    	strStartTime = ""
    End if
    
    if Request.Form("txtEndTime") <> "" then
    	strEndTime = Request.Form("txtEndTime") & " " & Request.Form("txtEndTimeType")
    else
    	strEndTime = ""
    End if
    
    strSubject = Request.Form("txtSubject")
    strDetails = Request.Form("txtDetails")
    strLocation = Request.Form("txtLocation")
    strRepeat = Request.Form("txtRepeatType")
    strStaffOnly = Request.Form("chkStaffOnly")
    Response.Write (Request.Form("chkStaffOnly"))
    
    		  
    '##################################################
    ''#  ASP - Check and escape apostrophies so that'
    '#				they dont break the SQL'
    '##################################################
    '
    strSubject = replace(strSubject, "'", "''")
    strDetails = replace(strDetails, "'", "''")
    strLocation = replace(strLocation, "'", "''")
    
    
    '##################################################
    ''#  ASP - Change some not nice expletives to'
    '#				harmless words or symbols.'
    '##################################################
    '
    strSubject = replace(strSubject, "fuck", "frell")
    strSubject = replace(strSubject, "shit", "poop")
    strSubject = replace(strSubject, "cunt", "c*%t")
    
    
    strDetails = replace(strDetails, "fuck", "frell")
    strDetails = replace(strDetails, "shit", "poop")
    strDetails = replace(strDetails, "cunt", "c*%t")
    
    strLocation = replace(strLocation, "fuck", "frell")
    strLocation = replace(strLocation, "shit", "poop")
    strLocation = replace(strLocation, "cunt", "c*%t")
    
    
    if strRepeat = "Weekly" then
    	dNewDate = strStartDate
    	dNewEndDate = strEndDate
    	for i = dNewDate to dNewEndDate
    		sSQL = "INSERT INTO tblcalendar(eventid,staffid,startdate,enddate,starttime,endtime,subject,details,location,repeat,staffonly) values('" & _
    			strEventid & "','" & strStaffid & "','" & dNewDate & "','" & dNewEndDate & "','" & strStartTime & "','" & strEndTime & "','" & strSubject & "','" & strDetails & "','" & strLocation & "','" & strRepeat & "','" & strStaffOnly & "');"
    		Set Rs = oConn.Execute(sSQL)
    		dNewDate = Cdate(dNewDate) + 7
    	next
    		
    else if strRepeat = "Fortnightly" then
    	dNewDate = strStartDate
    	dNewEndDate = strEndDate
    	for i = dNewDate to dNewEndDate
    		sSQL = "INSERT INTO tblcalendar(eventid,staffid,startdate,enddate,starttime,endtime,subject,details,location,repeat,staffonly) values('" & _
    			strEventid & "','" & strStaffid & "','" & dNewDate & "','" & dNewEndDate & "','" & strStartTime & "','" & strEndTime & "','" & strSubject & "','" & strDetails & "','" & strLocation & "','" & strRepeat & "','" & strStaffOnly & "');"
    		Set Rs = oConn.Execute(sSQL)
    		dNewDate = Cdate(dNewDate) + 14
    	next
    		
    else if strRepeat = "None" then
    		sSQL = "INSERT INTO tblcalendar(eventid,staffid,startdate,enddate,starttime,endtime,subject,details,location,repeat,staffonly) values('" & _
    		 	strEventid & "','" & strStaffid & "','" & strStartDate & "','" & strEndDate & "'," & strStartTime & "','" & strEndTime & "','" & strSubject & "','" & strDetails &  "','" & strLocation & "','" & strRepeat & "','" & strStaffOnly & "');"
    		Set Rs = oConn.Execute(sSQL)
    End if
    End if 
    End if 
     
    
    '*** Close the connection'
    oConn.Close
    Set oConn = Nothing
    
    Response.Redirect("calendar.asp?date=" & Server.URLEncode(strStartDate) & "#" & StrEventid) 
    
    %>
    What is the problem???
    Last edited by Kana; 11-27-04 at 05:26.

  2. #2
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    Ok.. you have three of these lines:
    Code:
    sSQL = "INSERT INTO tblcalendar(eventid,staffid,startdate,enddate,star  ttime,endtime,subject,details,location,repeat,staf  fonly) values('" & _
    	strEventid & "','" & strStaffid & "','" & dNewDate & "','" & dNewEndDate & "','" & strStartTime & "','" & strEndTime & "','" & strSubject & "','" & strDetails & "','" & strLocation & "','" & strRepeat & "','" & strStaffOnly & "');"
    Your second line does not start with a "double quote" to begin the string. Add a single "double quote" before strEventid for each INSERT statement and try again..

    In the future, blank out the curse words from your filter, I don't think we need to see them to troubleshoot the problem
    That which does not kill me postpones the inevitable.

  3. #3
    Join Date
    Nov 2004
    Posts
    2
    It's works!!
    I have changed that part and some codes then it works!

    Thank you very very much for your reply!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •