Forum Moderators: open
I'm using the following code to take values from a form and insert them into an access db. They all work fine apart from the date which is a three form values put together. The form values are carried over, but the moment I seperate them with / I get the error as though I'm not using the # to tell access it's a date value - any help most appreciated on this one before my PC goes through the window!
<%
Dim Conn, ConnString
Set Conn = Server.CreateObject("ADODB.Connection")
ConnString = "DRIVER={Microsoft Access Driver (*.mdb)};" & _
"DBQ=" & Server.MapPath("db\gateway.mdb") & ";"
Conn.Open(ConnString)
SQL = "insert into course (Coursename,CourseLocation,CourseDate) values ('" & request("CourseName") & "','" & request("CourseLocation") & "',#" & request.form("courseday") &"/" & request.form("coursemonth") &"/"&request.form("courseyear")&"#)"
Conn.execute(SQL)
Conn.close
response.redirect("courseinserted.html")
%>
SQL = "insert into course (Coursename,CourseLocation,CourseDate) values ('" & request("CourseName") & "','" & request("CourseLocation") & "', " # & request.form("courseday") &"/" & request.form("coursemonth") &"/"&request.form("courseyear")& # ")"
The # goes on the inside of the quote, not the outside.
-Matt