Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nested If's

Status
Not open for further replies.

Johno2090

Programmer
May 3, 2002
31
GB
Im having some problems with my nested if statment below! has anyone got any tips or alternative ways of coding this??

the error is
Error Type:
Microsoft VBScript compilation (0x800A03EA)
Syntax error
/toner/view.asp, line 93, column 8

<% OPTION EXPLICIT %>
<!--#include file=&quot;common.inc&quot; -->
<%
dim rsveiw
dim strID, strPname, strrequestedby, strdate, strSortBy, strteam
dim intrecordloopcounter
dim strcollected, strcollect, recived

recived = &quot;Collected&quot;

strSortBy = &quot;ID DESC&quot;
strsql = &quot;SELECT tblrequestedasp.* &quot;
strSQL = strSQL & &quot;FROM tblrequestedasp &quot;
strSQL = strSQL & &quot;ORDER BY tblrequestedasp.&quot; & strSortBy & &quot;;&quot;

Set rsveiw = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsveiw.CursorType = 1
rsveiw.open strSQL, strCon

%>
<body bgcolor=&quot;#FFFFFF&quot;>
<form action=&quot;modify.asp&quot; method=&quot;post&quot;>
<table width=&quot;100%&quot; border=&quot;2&quot; cellpadding=&quot;3&quot; cellspacing=&quot;0&quot; bordercolorlight=&quot;#FFFFFF&quot; bordercolordark=&quot;#FFFFFF&quot; bgcolor=&quot;#FFFFCC&quot; bordercolor=&quot;#6699FF&quot; class=&quot;unnamed1&quot;>
<tr class=&quot;tableheading&quot; bgcolor=&quot;#003399&quot;>

<th align=&quot;left&quot; width=&quot;15%&quot; bgcolor=&quot;0060a5&quot;>
<div align=&quot;center&quot; class=&quot;tableheaders&quot;>Date Sent</div>
</th>

<th align=&quot;left&quot; width=&quot;25%&quot; bgcolor=&quot;0060a5&quot;>
<div align=&quot;center&quot; class=&quot;tableheaders&quot;>Printer</div>
</th>

<th align=&quot;left&quot; width=&quot;25%&quot; bgcolor=&quot;0060a5&quot;>
<div align=&quot;center&quot; class=&quot;tableheaders&quot;>Team</div>
</th>

<th align=&quot;left&quot; width=&quot;30%&quot; bgcolor=&quot;0060a5&quot;>
<div align=&quot;center&quot; class=&quot;tableheaders&quot;>Name</div>
</th>
<th align=&quot;left&quot; width=&quot;10%&quot; bgcolor=&quot;0060a5&quot;>
<div align=&quot;center&quot; class=&quot;tableheaders&quot;>Collected</div>
</th>
</tr>

<%

For intRecordLoopCounter = 1 to 20

strpname = rsveiw.Fields(&quot;printer&quot;)
strteam = rsveiw.Fields(&quot;team&quot;)
strdate = rsveiw.Fields(&quot;date&quot;)
strID = rsveiw.Fields(&quot;name&quot;)
strcollect = rsveiw.fields(&quot;collected&quot;)

if strcollect = true then
strcollected = &quot;YES&quot;
else
strcollected = &quot;NO&quot;
end if

strNTUser = RTrim(Request.ServerVariables(&quot;LOGON_USER&quot;))
iPos = Len(strNTUser) - InStr(1, strNTUser,&quot;\&quot;,1)
strNTUser = Right(strNTUser, iPos)


%>
<tr>
<tr class=&quot;tableheading&quot; bgcolor=&quot;#003399&quot;>

<th align=&quot;left&quot; width=&quot;15%&quot; bgcolor=&quot;#CCCCCC&quot;>
<div align=&quot;center&quot; class=&quot;tableheaders&quot;><% response.write strdate %></div>
</th>

<th align=&quot;left&quot; width=&quot;25%&quot; bgcolor=&quot;#CCCCCC&quot;>
<div align=&quot;center&quot; class=&quot;tableheaders&quot;><% response.write strpname %></div>
</th>

<th align=&quot;left&quot; width=&quot;25%&quot; bgcolor=&quot;#CCCCCC&quot;>
<div align=&quot;center&quot; class=&quot;tableheaders&quot;><% response.write strteam %></div>
</th>

<th align=&quot;left&quot; width=&quot;30%&quot; bgcolor=&quot;#CCCCCC&quot;>
<div align=&quot;center&quot; class=&quot;tableheaders&quot;><% response.write strID %></div>
</th>
<th align=&quot;left&quot; width=&quot;10%&quot; bgcolor=&quot;#CCCCCC&quot;>
<div align=&quot;center&quot; class=&quot;tableheaders&quot;><%

if strNTUser = &quot;Chris.Johnson&quot; or &quot;Gareth.Finlay&quot; then

If strcollected = &quot;NO&quot; then
response.write &quot;<input TYPE=checkbox NAME=<%Recived & intRecordLoopCounter %> value = false>&quot;
Else
response.write &quot;<input TYPE=checkbox NAME=<%Recived & intRecordLoopCounter %> value = true>&quot;
End if
Else
response.write strcollected
End if
%></div>
</th>
</tr>
<%
rsveiw.MoveNext
If rsveiw.EOF Then Exit For
Next
%>
</table>
</form>
 
This line:

if strNTUser = &quot;Chris.Johnson&quot; or &quot;Gareth.Finlay&quot; then


Should be

if strNTUser = &quot;Chris.Johnson&quot; OR strNTUser = &quot;Gareth.Finlay&quot; then
 
you have a if thats starts:

if strNTUser = &quot;Chris.Johnson&quot; or &quot;Gareth.Finlay&quot; then

rewrite that whole block to:


if strNTUser = &quot;Chris.Johnson&quot; or &quot;Gareth.Finlay&quot; then

If strcollected = &quot;NO&quot; then
response.write &quot;<input TYPE=checkbox NAME='&quot; & Recived & intRecordLoopCounter & &quot;'>&quot;
Else
response.write &quot;<input TYPE=checkbox NAME='&quot; & Recived & intRecordLoopCounter & &quot;' checked>&quot;
End if
Else
response.write strcollected
End if
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top