Forums
This topic is locked
Insert image 1 if true otherwise insert image 2
Posted 10 Nov 2003 17:01:17
1
has voted
10 Nov 2003 17:01:17 Martin Howell posted:
Basically I have a checkbox in my Access database and I want to display a TICK on my details page if the value in the database is TRUE, if it is FALSE then I want to display a CROSS.Sounds simple but just can't work out how to do it, anyone have any idea's. I am using MX so an extension would be fine but handdonding would be ok to, just need it done. Thanks
Replies
Replied 11 Nov 2003 00:28:22
11 Nov 2003 00:28:22 Phil Shevlin replied:
<pre id=code><font face=courier size=2 id=code>
<img src="<% if ((rs.Fields.Item("field".Value) <> "FALSE" then %>TICK<%Else%>CROSS<%End If%>">
</font id=code></pre id=code>
<img src="<% if ((rs.Fields.Item("field".Value) <> "FALSE" then %>TICK<%Else%>CROSS<%End If%>">
</font id=code></pre id=code>
Replied 15 Nov 2003 17:02:27
15 Nov 2003 17:02:27 Martin Howell replied:
I've put the code in but still seem to be having problems as although the value in the database is 0 (false) the tick image still appears.
I have put my DB info in changed false to 0 and then replaced the words TICK and CROSS with the full url of the pictures. I tried pasting it in but it won't display properly even when I select code. You can email me if you want to see the code (m.howell@@lineone.net)
Can you spot what I've done wrong?
Thanks
<img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>
I have put my DB info in changed false to 0 and then replaced the words TICK and CROSS with the full url of the pictures. I tried pasting it in but it won't display properly even when I select code. You can email me if you want to see the code (m.howell@@lineone.net)
Can you spot what I've done wrong?
Thanks
<img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>
Replied 15 Nov 2003 17:23:25
15 Nov 2003 17:23:25 Phil Shevlin replied:
Then reverse it and look for true..
<pre id=code><font face=courier size=2 id=code>
<img src="<% if ((rs.Fields.Item("FieldName".Value) = True) then %>pix/tick.gif<%Else%>pix/cross.gif<%End If%>">
</font id=code></pre id=code>
If that doesn't work...
Try just displaying the field value instead of displaying the picture...
<pre id=code><font face=courier size=2 id=code> <%=(rs.Fields.Item("FieldName".Value)%></font id=code></pre id=code>
... and see what values the browser is seeing. Then test for them (If "1" Else - or - If "Yes" Else, etc...)
<pre id=code><font face=courier size=2 id=code>
<img src="<% if ((rs.Fields.Item("FieldName".Value) = True) then %>pix/tick.gif<%Else%>pix/cross.gif<%End If%>">
</font id=code></pre id=code>
If that doesn't work...
Try just displaying the field value instead of displaying the picture...
<pre id=code><font face=courier size=2 id=code> <%=(rs.Fields.Item("FieldName".Value)%></font id=code></pre id=code>
... and see what values the browser is seeing. Then test for them (If "1" Else - or - If "Yes" Else, etc...)
Replied 15 Nov 2003 18:43:24
15 Nov 2003 18:43:24 Dave Thomas replied:
i use this code myself and it does work.
<pre id=code><font face=courier size=2 id=code>
<% IF rsRecordset.Fields.Item("YourField" = "True" THEN %>
<img src="GreenTick.gif" width "12" height="12" border="0" alt="Yes">
<% ELSE %>
<img src="RedCross.gif" width "12" height="12" border="0" alt="No">
<% END IF %>
</font id=code></pre id=code>
just replace <b>rsRecordset.Fields.Item("YourField" </b> with what your rs code is
and swap gif names for GreenTick and RedCross.
Regards,
Dave
UD4 | Flash 5/MX | Studio MX | SQL | Access | ASP/VBScript | XP-Pro
<pre id=code><font face=courier size=2 id=code>
<% IF rsRecordset.Fields.Item("YourField" = "True" THEN %>
<img src="GreenTick.gif" width "12" height="12" border="0" alt="Yes">
<% ELSE %>
<img src="RedCross.gif" width "12" height="12" border="0" alt="No">
<% END IF %>
</font id=code></pre id=code>
just replace <b>rsRecordset.Fields.Item("YourField" </b> with what your rs code is
and swap gif names for GreenTick and RedCross.
Regards,
Dave
UD4 | Flash 5/MX | Studio MX | SQL | Access | ASP/VBScript | XP-Pro
Replied 16 Nov 2003 14:20:57
16 Nov 2003 14:20:57 Martin Howell replied:
Excellent, works a treat
Thanks for that guys
<img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle>
Thanks for that guys
<img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle>