Forums
This topic is locked
How do you update upon a certain condition?
24 Jan 2003 16:02:24 James Lee posted:
Hello all,I have this peculiar problem that has been troubling me. I have this web-site created from DWMX using ASP with VBscript. I have this image call 'Discontinued' and the height of image is 45 pixels. I have a field call 'Imageheight' in the database and it is set to 1 pixel by default(i.e. there is no discontinued).
I have another field in the database called 'Discontinued' where I have a true/false logic inside Access. (i.e. -1,0)
I have implemented a checkbox inside the form and I call it 'discontinued'. If the person ticks the checkbox, that means it is -1.
How do I link and update so that when it turns to -1, the 'Imageheight' field in my database would turn to 45 whereas if I untick the checkbox, Imageheight field would turn to 1( cos images cannot have 0 pixels.)
Thanks for reading this!
Replies
Replied 25 Jan 2003 17:09:05
25 Jan 2003 17:09:05 Jørgen Emerslund replied:
Hi,
First of all, If I haven't understood you, I'm sorry. If that's the case, let me know and I'll take a look at it.
I Think you want something like this:
<%
' Code for executing the sql-query into a recordset called rsRec
If rsRec("Discontinued"
= 0 Then
strImageHeight = "45"
Else
strImageHeight = "1"
End If
%>
<IMG scr="discontinued.gif" Height="<%= strImageHeight %>">
Note that this requires the data from the checkbox to be in the database already...
I am not sure if you need the field imageheight in the database at all, since you can determine the height you want with by simple programming.
If there is anything else, just ask...
First of all, If I haven't understood you, I'm sorry. If that's the case, let me know and I'll take a look at it.
I Think you want something like this:
<%
' Code for executing the sql-query into a recordset called rsRec
If rsRec("Discontinued"

strImageHeight = "45"
Else
strImageHeight = "1"
End If
%>
<IMG scr="discontinued.gif" Height="<%= strImageHeight %>">
Note that this requires the data from the checkbox to be in the database already...
I am not sure if you need the field imageheight in the database at all, since you can determine the height you want with by simple programming.
If there is anything else, just ask...