|
 |
access_asp thread: ASP If statements
Message #1 by "Lacey Meschede" <refllace@h...> on Wed, 12 Feb 2003 17:53:34
|
|
Hello,
I'm sure someone has seen this before and can help. I have a form that is
processed by ASP. When I use this code:
If total >= 300 then
if total <= 500 then
response.write "deliverycharge = 5.00"
endif
else
response.write "deliverycharge = 10.00"
EndIf
************
I get this error:
Microsoft VBScript compilation error '800a0400'
Expected statement
/npss/cater/calculate.asp, line 265
endif
********
Total is a variable based on two other variables that are derived from
form input. Delivery charge is a variable that will be used in a later
equasion. The code is currently in the body part of the page. I have
tried lots of things but nothing seems to work. Any help is greatly
apreciated.
Lacey
refllace@h...
Message #2 by "Zee Computer Consulting" <zee@t...> on Wed, 12 Feb 2003 16:41:28 -0800
|
|
Try using two words: END IF
instead of one word: endif
-- Z
----- Original Message -----
From: "Lacey Meschede" <refllace@h...>
To: "Access ASP" <access_asp@p...>
Sent: Wednesday, February 12, 2003 5:53 PM
Subject: [access_asp] ASP If statements
> Hello,
>
> I'm sure someone has seen this before and can help. I have a form that is
> processed by ASP. When I use this code:
>
> If total >= 300 then
> if total <= 500 then
> response.write "deliverycharge = 5.00"
> endif
> else
> response.write "deliverycharge = 10.00"
> EndIf
> ************
> I get this error:
>
> Microsoft VBScript compilation error '800a0400'
>
> Expected statement
>
> /npss/cater/calculate.asp, line 265
>
> endif
> ********
> Total is a variable based on two other variables that are derived from
> form input. Delivery charge is a variable that will be used in a later
> equasion. The code is currently in the body part of the page. I have
> tried lots of things but nothing seems to work. Any help is greatly
> apreciated.
>
> Lacey
> refllace@h...
>
Message #3 by "Ken Schaefer" <ken@a...> on Mon, 17 Feb 2003 16:42:47 +1100
|
|
<%
If intTotal >= 300 and intTotal <=500 then
strMessage = "deliverycharge = 5.00"
Else
strMessage = "deliverycharge = 10.00"
End If
Response.Write(strMessage)
%>
a) You misspelt "End If" (you need a space)
b) Your logic can be collapsed into a single construct, reducing your code
complexity
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Lacey Meschede" <refllace@h...>
Subject: [access_asp] ASP If statements
: Hello,
:
: I'm sure someone has seen this before and can help. I have a form that is
: processed by ASP. When I use this code:
:
: If total >= 300 then
: if total <= 500 then
: response.write "deliverycharge = 5.00"
: endif
: else
: response.write "deliverycharge = 10.00"
: EndIf
: ************
: I get this error:
:
: Microsoft VBScript compilation error '800a0400'
:
: Expected statement
:
: /npss/cater/calculate.asp, line 265
:
: endif
: ********
: Total is a variable based on two other variables that are derived from
: form input. Delivery charge is a variable that will be used in a later
: equasion. The code is currently in the body part of the page. I have
: tried lots of things but nothing seems to work. Any help is greatly
: apreciated.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
 |