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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IF ELSEIF STATEMENTS

Status
Not open for further replies.

asrg

Technical User
Jul 11, 2011
9
GB
Hi ..

My page is connected to an Access DB running on IIS 7.

Im simply trying to show an image if the condition is true. I have 4 conditions looking at True/False fileds in the Db..
Ive Tried this code but no real luck ...

Just get error
/fusion/css/Z.ASP, line 187
elseif (openlist.Fields.Item("netmeetcall").Value)
^


<!-- START if statements -->
<%
if (openlist.Fields.Item("telcall").Value) then response.write ("<img src='../images/icons/mobile_phone.gif' alt='True'>")
elseif (openlist.Fields.Item("netmeetcall").Value)
then response.write ("<img src='../images/icons/netmeet.gif' alt='True'>")
elseif (openlist.Fields.Item("opdef").Value)
then response.write ("<img src='../images/icons/tick.gif' alt='True'>")
elseif (openlist.Fields.Item("emailcall").Value)
then response.write ("<img src='../images/icons/tick.gif' alt='True'>")
else response.write ("nothing")
end if
%>

<!-- END if statements -->

Im a new technical developer and stuck ... HELP :-(
 
Your first "if... then" statement is on one line, meaning it starts and ends on that line, no "end if" expected.

When using "if..then..elseif...else...end if", your introducing if ... then statement must be on two lines, like this:
Code:
if (openlist.Fields.Item("telcall").Value) then
 response.write ("<img src='../images/icons/mobile_phone.gif' alt='True'>")

;-)

Cheers,
MakeItSo

[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
Also:

does "telcall" return a boolean value? if not, you must first make a comparison:
Code:
if (openlist.Fields.Item("telcall").Value[b][red] = comparetowhateverstring[/red][/b])

[b][navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell[/b]
 
Thanks guys, it works great. Makitso, (openlist.Fields.Item("telcall").Value is true/false.

Code ------ this works great Many thanks Makeitso
<%
if (openlist.Fields.Item("telcall").Value) then
response.write ("<img src='../images/icons/mobile_phone.gif' alt='True'>")
elseif (openlist.Fields.Item("netmeetcall").Value) then
response.write ("<img src='../images/icons/netmeet.gif' alt='True'>")
elseif (openlist.Fields.Item("opdef").Value) then
response.write ("<img src='../images/icons/tick.gif' alt='True'>")
elseif (openlist.Fields.Item("emailcall").Value) then
response.write ("<img src='../images/icons/tick.gif' alt='True'>")
else response.write ("nothing")
end if
%>
 
Its attention to the small details in life ... lesson learnt :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top