View Single Post
  #1 (permalink)  
Old May 10th, 2005, 12:24 PM
kingleon kingleon is offline
Registered User
 
Join Date: May 2005
Location: , , USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to kingleon
Default Syntax error in INSERT INTO statement.

Hi,
I'm trying to add this fields to an access db, but I get this error.

Insert into tb_blackhistorymonth (ProgramTitle, Coordinator, Events, EventTime, Location, Contact, Summary, ) VALUES ('q', 'sdadssa', 'gfsdfgf', 'fdsgf', 'gsdfgsdf', ##, #5:00 PM# )
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.

Here is my code.
Please advice.





<%
Dim sSQL
Dim strProgramTitle
Dim strCoordinator
Dim strEvents
Dim strEventtime
Dim strLocation
Dim strContact
Dim strSummary
Dim strSubmitted
Dim errMsg

strProgramTitle = Request.Form("ProgramTitle")
strCoordinator = Request.Form("Coordinator")
strEvents = Request.Form("Events")
strEventtime = Request.Form("Eventtime")
strLocation = Request.Form("Location")
strContact = Request.Form("Contact")
strSummary = Request.Form("Summary")
strSubmitted = Request.Form("Submitted")

'declare your variables
'dim connection
'dim sSQL, sConnString

call OpenDB(strdb, db)

'declare SQL statement that will query the database
    sSQL = "Insert into tb_blackhistorymonth ("
    sSQL = sSQL & "ProgramTitle, "
    sSQL = sSQL & "Coordinator, "
    sSQL = sSQL & "Events, "
    sSQL = sSQL & "EventTime, "
    sSQL = sSQL & "Location, "
    sSQL = sSQL & "Contact, "
    sSQL = sSQL & "Summary, "
    'sSQL = sSQL & "Submitted, "
    sSQL = sSQL & " ) VALUES ("
    'sSQL = sSQL & "FALSE, "
    sSQL = sSQL & "'" & trim(CheckString(strProgramTitle)) & "', "
    sSQL = sSQL & "'" & trim(CheckString(strCoordinator)) & "', "

    sSQL = sSQL & "'" & trim(CheckString(strLocation)) & "', "
    sSQL = sSQL & "'" & trim(CheckString(strContact)) & "', "
    sSQL = sSQL & "'" & trim(CheckString(strSummary)) & "', "
    sSQL = sSQL & "#" & trim(CheckString(strEvents)) & "#, "
    sSQL = sSQL & "#" & trim(CheckString(strEventTime)) & "# "

    'sSQL = sSQL & " #" & trim(CheckString(strSubmitted)) & "# "
    sSQL = sSQL & ")"

    response.write (sSQL)
    'do the deed
    'send it off
    cnndb.execute(sSQL)

'execute the SQL
'connection.execute(sSQL)

response.write "The data was inserted successfully."
   cnndb.close
'close the object and free up resources
'Connection.Close
Set cnndb = Nothing

%>


Thank you
Kingleon

Reply With Quote