Question
help with IF, ELSE IF and ELSE. ASP/VB
Hi,
I have a numerical value (currency) taken from a database field which I
display on an ASP page. I want to use IF, ELSE IF and ELSE, assuming that's
the best way to go about it, to add mark up charges to the value in the
database.
For example, if the value in the database field is equal to, or less than,
45, then 5 is added:
So far I've got:
<%IF (rsRecordset.Fields.Item("price7day").Value) <= 45 Then%>
<%=
FormatCurrency(((rsRecordset.Fields.Item("price7day").Value)+5), -1, -2, -2,
-2) %>
<%End IF%>
This works a treat! What I'm stuck with is how to then apply a different
charge if the number is BETWEEN two values. I tried this:
<%IF (rsRecordset.Fields.Item("price7day").Value) <= 45 Then%>
<%=
FormatCurrency(((rsRecordset.Fields.Item("price7day").Value)+5), -1, -2, -2,
-2) %>
<%Else IF (rsRecordset.Fields.Item("price7day").Value) >= 45.01 AND <= 99.99
Then%>
<%=
FormatCurrency(((rsRecordset.Fields.Item("price7day").Value)+10), -1, -2, -2,
-2) %>
<%End IF%>
...but this isn't working, producing an error at the word "AND".
Can someone show me how this should be laid out? Much appreciated.
Regards
nathon.
I have a numerical value (currency) taken from a database field which I
display on an ASP page. I want to use IF, ELSE IF and ELSE, assuming that's
the best way to go about it, to add mark up charges to the value in the
database.
For example, if the value in the database field is equal to, or less than,
45, then 5 is added:
So far I've got:
<%IF (rsRecordset.Fields.Item("price7day").Value) <= 45 Then%>
<%=
FormatCurrency(((rsRecordset.Fields.Item("price7day").Value)+5), -1, -2, -2,
-2) %>
<%End IF%>
This works a treat! What I'm stuck with is how to then apply a different
charge if the number is BETWEEN two values. I tried this:
<%IF (rsRecordset.Fields.Item("price7day").Value) <= 45 Then%>
<%=
FormatCurrency(((rsRecordset.Fields.Item("price7day").Value)+5), -1, -2, -2,
-2) %>
<%Else IF (rsRecordset.Fields.Item("price7day").Value) >= 45.01 AND <= 99.99
Then%>
<%=
FormatCurrency(((rsRecordset.Fields.Item("price7day").Value)+10), -1, -2, -2,
-2) %>
<%End IF%>
...but this isn't working, producing an error at the word "AND".
Can someone show me how this should be laid out? Much appreciated.
Regards
nathon.
