Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80040E14) [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Unit WHERE Status='Approved' AND WHERE Unit=ALLRED UNIT'.
Here is my code:
<%
dim rst1
set rst1 = Server.CreateObject("ADODB.Recordset")
rst1.Open "SELECT Unit FROM Prison Where Status='APPROVED' ORDER BY Unit", conn, 3, 3
do while not rst1.EOF
strUnit=rst1.Fields("Unit")
%>
<THEAD>
<TR class=textcol style="BACKGROUND-COLOR:rgb(216,233,236)">
<TD nowrap width=120 colspan="3">
<div align="center"><%=rst1.Fields("Unit")%> </div>
</TD>
</TR>
</THEAD>
<TBODY>
<TR>
<% set rst = Server.CreateObject("ADODB.Recordset")
rst.LockType = 3
rst.CursorType = 3
strSql= "SELECT FirstName, LastName, Birthday, Unit FROM Prison ORDER BY Unit WHERE Status='Approved' AND WHERE Unit="& strUnit
rst.Open strSQL, conn
'Response.Write strSql
Do While Not rst.EOF
%>
<TD nowrap >
<%=rst.Fields("FirstName")%> </TD>
<TD nowrap >
<%=rst.Fields("LastName")%> </TD>
<TD nowrap >
<%=rst.Fields("Birthday")%> </TD>
</TR>
<%
R.MoveNext
loop
R.Close
set R=nothing
rst1.MoveNext
%>
<%
loop
rst1.Close
set rst1=nothing
%>

Help



Back to top











