On the first page, I have this:
<TR>
<TD><FONT CLASS='Arial10' COLOR='darkred'><B>
Department</B>
</TD>
<td><select name="Driverdept">
<%
sql = "SELECT tblDept.DeptID, tblDept.DeptName FROM tblDept "
set deptset = safetyDB.Execute(sql)
While not DeptSet.EOF
%>
<option value="<%=DeptSet(0)%>"><%=DeptSet(1)%></option>
<%
DeptSet.MoveNext
wend
%>
</select>
</td>
</TR>
(of course, there are more form objects on this page)
on another page, I have this:
DriverDept = request.form("DriverDept"
LocationDesc = request.form("LocationDesc"
AccidentWeather = request.form("AccidentWeather"
AccidentFactor = request.form("AccidentFactor"
AccidentCollision = request.form("AccidentCollision"
AccidentDesc = request.form("AccidentDesc"
AccidentDate = request.form("AccidentDate"
TimeOfAccident = request.form("TimeOfAccident"
TimeOfAccidentAMPM = request.form("TimeOfAccidentAMPM"
Age = request.Form("Age"
Drug = request.Form("Drug"
TestType = request.Form("TestType"
Result = request.Form("Result"
AtFault = request.Form("AtFault"
Condition = request.Form("Condition"
InjuryType = request.Form("InjuryType"
'we need to do a select statement to retrieve to primary key for the driver's dept.
thissql = "SELECT * FROM tblDept where tblDept.DeptID = "&DriverDept&""
set depSet = safetyDB.Execute(thissql)
If Not depSet.Eof then
DeptID = depSet("DeptID"
End If
depSet.close
set depSet = nothing
'Now we have everything lets create a record in the tblAccidentMain then retrieve the AccidentID
SafetyDB.Execute = "INSERT INTO AccidentMain (DeptID, Loc_Desc, FactorsDesc, CollisionDesc, WeatherDesc,InjuryDesc, AccidentDate,TimeOfAccident,TimeOfAccidentAMPM,AccidentDesc,atFault,TestType,Result,DrugTest) VALUES ("DriverDept", '"&LocationDesc&"', '"&AccidentFactor&"', '"&AccidentCollision&"', '"&AccidentWeather&"', '"&InjuryType&"', '"&AccidentDate&"', '"&TimeOfAccident&"', '"&TimeOfAccidentAMPM&"', '"&AccidentDesc&"' ,'"&atFault&"', '"&TestType&"', '"&Result&"', '"&DrugTest&"')"
sqltext = "SELECT AccidentMain.AccidentID FROM AccidentMain ORDER BY AccidentID DESC"
set Accidentset = safetyDB.Execute(sqltext)
if not Accidentset.eof then
AccidentID = Accidentset(0)
end if
But I just can't get beyond this error message:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]
Line 40: Incorrect syntax near '='
which is here:
set depSet = safetyDB.Execute(thissql
Any help resolving this would be greatly appreciated.
<TR>
<TD><FONT CLASS='Arial10' COLOR='darkred'><B>
Department</B>
</TD>
<td><select name="Driverdept">
<%
sql = "SELECT tblDept.DeptID, tblDept.DeptName FROM tblDept "
set deptset = safetyDB.Execute(sql)
While not DeptSet.EOF
%>
<option value="<%=DeptSet(0)%>"><%=DeptSet(1)%></option>
<%
DeptSet.MoveNext
wend
%>
</select>
</td>
</TR>
(of course, there are more form objects on this page)
on another page, I have this:
DriverDept = request.form("DriverDept"
LocationDesc = request.form("LocationDesc"
AccidentWeather = request.form("AccidentWeather"
AccidentFactor = request.form("AccidentFactor"
AccidentCollision = request.form("AccidentCollision"
AccidentDesc = request.form("AccidentDesc"
AccidentDate = request.form("AccidentDate"
TimeOfAccident = request.form("TimeOfAccident"
TimeOfAccidentAMPM = request.form("TimeOfAccidentAMPM"
Age = request.Form("Age"
Drug = request.Form("Drug"
TestType = request.Form("TestType"
Result = request.Form("Result"
AtFault = request.Form("AtFault"
Condition = request.Form("Condition"
InjuryType = request.Form("InjuryType"
'we need to do a select statement to retrieve to primary key for the driver's dept.
thissql = "SELECT * FROM tblDept where tblDept.DeptID = "&DriverDept&""
set depSet = safetyDB.Execute(thissql)
If Not depSet.Eof then
DeptID = depSet("DeptID"
End If
depSet.close
set depSet = nothing
'Now we have everything lets create a record in the tblAccidentMain then retrieve the AccidentID
SafetyDB.Execute = "INSERT INTO AccidentMain (DeptID, Loc_Desc, FactorsDesc, CollisionDesc, WeatherDesc,InjuryDesc, AccidentDate,TimeOfAccident,TimeOfAccidentAMPM,AccidentDesc,atFault,TestType,Result,DrugTest) VALUES ("DriverDept", '"&LocationDesc&"', '"&AccidentFactor&"', '"&AccidentCollision&"', '"&AccidentWeather&"', '"&InjuryType&"', '"&AccidentDate&"', '"&TimeOfAccident&"', '"&TimeOfAccidentAMPM&"', '"&AccidentDesc&"' ,'"&atFault&"', '"&TestType&"', '"&Result&"', '"&DrugTest&"')"
sqltext = "SELECT AccidentMain.AccidentID FROM AccidentMain ORDER BY AccidentID DESC"
set Accidentset = safetyDB.Execute(sqltext)
if not Accidentset.eof then
AccidentID = Accidentset(0)
end if
But I just can't get beyond this error message:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]
Line 40: Incorrect syntax near '='
which is here:
set depSet = safetyDB.Execute(thissql
Any help resolving this would be greatly appreciated.