Question : IF THEN statement with link to web pages

I have the attached code which displays data from a table.

What I would like to do is add an extra column that will display a link to an .htm page in a seperate window depending on what results are in the 'room' and 'floor' fields.

I would imagine I would need to do an IF THEN statement but what I have tried so far has not worked. Below is what I have tried and would have to fit into the code attached.

e.g. IF Rs('floor') = '5' and Rs('building') = 'CSM' THEN Response.Write ("<td bgcolor = '#CCCCCC'><font size=1><a href='L5_CSMHS.htm'>Location Map</a></font></td>")
ELSE IF Rs('floor') = '4' and Rs('building') = 'CSM' THEN Response.Write ("<td bgcolor = '#CCCCCC'><font size=1><a href='L4_CSM.htm'>Location Map</a></font></td>")
ELSE Response.Write ("<td bgcolor = '#CCCCCC'><font size=1>No Location Map exists for this room</font></td>")
END IF

The above doesn't work but hopefully demonstrates what I want to do. Can anyone help with this please?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
Response.Write "<table border=0 cellspacing=2 cellpadding=5>" 
Response.Write "<tr>"&"<td colspan='3' align='center'><font size=1>"&"Select a result and click 'Select'"&"</font></td>"&"</tr>" 
Response.Write "<tr>"&"<th><font size=1>"&"Switch"&"</font></th>"&"<th><font size=1>"&"Port"&"</font></th>"&"<th><font size=1>"&"Connected To"&"</font></th>"&"<th><font size=1>"&"Comments"&"</font></th>"&"<th><font size=1>"&"Room"&"</font></th>"&"<th><font size=1>"&"Floor"&"</font></th>"&"<th><font size=1>"&"Building"&"</font></th></tr>" 
if NOT Rs.EOF then
Do While not Rs.EOF 
    Response.Write ("<tr>") 
    Response.Write ("<td bgcolor = '#CCCCCC'><font size=1>"&Rs("switch")&"</font></td>") 
	Response.Write ("<td bgcolor = '#CCCCCC'><font size=1>"&Rs("port")&"</font></td>") 
    Response.Write ("<td bgcolor = '#CCCCCC'><font size=1>"&Rs("connected_to")&"</font></td>") 
	Response.Write ("<td bgcolor = '#CCCCCC'><font size=1>"&Rs("comments")&"</font></td>") 
	Response.Write ("<td bgcolor = '#CCCCCC'><font size=1>"&Rs("room")&"</font></td>") 
    Response.Write ("<td bgcolor = '#CCCCCC'><font size=1>"&Rs("floor")&"</font></td>") 
	Response.Write ("<td bgcolor = '#CCCCCC'><font size=1>"&Rs("building")&"</font></td>") 
	Response.Write ("</tr>") 
    Rs.MoveNext
Loop 
else 
   Response.Write("No records found")
end if
Response.Write "</table>"

Answer : IF THEN statement with link to web pages

Each IF branch needs to be in a new line.
Also, if you are using multiple conditions, ELSEIF is a single word
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
Response.Write "<table border=0 cellspacing=2 cellpadding=5>" 
Response.Write "<tr>"&"<td colspan='3' align='center'><font size=1>"&"Select a result and click 'Select'"&"</font></td>"&"</tr>" 
Response.Write "<tr>"&"<th><font size=1>"&"Switch"&"</font></th>"&"<th><font size=1>"&"Port"&"</font></th>"&"<th><font size=1>"&"Connected To"&"</font></th>"&"<th><font size=1>"&"Comments"&"</font></th>"&"<th><font size=1>"&"Room"&"</font></th>"&"<th><font size=1>"&"Floor"&"</font></th>"&"<th><font size=1>"&"Building"&"</font></th></tr>" 
if NOT Rs.EOF then
Do While not Rs.EOF 
    Response.Write ("<tr>") 
    Response.Write ("<td bgcolor = '#CCCCCC'><font size=1>"&Rs("switch")&"</font></td>") 
	Response.Write ("<td bgcolor = '#CCCCCC'><font size=1>"&Rs("port")&"</font></td>") 
    Response.Write ("<td bgcolor = '#CCCCCC'><font size=1>"&Rs("connected_to")&"</font></td>") 
	Response.Write ("<td bgcolor = '#CCCCCC'><font size=1>"&Rs("comments")&"</font></td>") 
	Response.Write ("<td bgcolor = '#CCCCCC'><font size=1>"&Rs("room")&"</font></td>") 
    Response.Write ("<td bgcolor = '#CCCCCC'><font size=1>"&Rs("floor")&"</font></td>") 
	Response.Write ("<td bgcolor = '#CCCCCC'><font size=1>"&Rs("building")&"</font></td>") 

IF Rs('floor') = '5' and Rs('building') = 'CSM' THEN
   Response.Write ("<td bgcolor = '#CCCCCC'><font size=1><a href='L5_CSMHS.htm'>Location Map</a></font></td>")
ELSEIF Rs('floor') = '4' and Rs('building') = 'CSM' THEN
   Response.Write ("<td bgcolor = '#CCCCCC'><font size=1><a href='L4_CSM.htm'>Location Map</a></font></td>")
ELSE
   Response.Write ("<td bgcolor = '#CCCCCC'><font size=1>No Location Map exists for this room</font></td>")
END IF

	Response.Write ("</tr>") 
    Rs.MoveNext
Loop 
else 
   Response.Write("No records found")
end if
Response.Write "</table>"
Random Solutions  
 
programming4us programming4us