Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: test to see if a value is in a range


Message #1 by "Andrew Matheson" <amatheso@y...> on Wed, 6 Mar 2002 16:55:28
Hi.



I have a simple prob.  I want to take a variable and test it to see if it 

fits in a range.



ie i take the value x and assign it a value



the code i want to get working is:



   If x >=1 AND <=10 then



       response.write "x falls between 1 an 10"



   Else



       response.write "x Dose Not fall between 1 an 10"



   End If



This is  a more simple version of what i am trying to do.  However i just 

want to know exactly how to write the code correctly in ASP. is the 

compariative bit correct.  I can't get it working??!





Please Help!



regards



Andrew

Message #2 by "Dave Savage" <dave@t...> on Wed, 6 Mar 2002 17:08:12 -0000
ASP IF statements can only accept one argument.

Try:



if x >= 1 then

	if x <= 10 then

response.write "x falls between 1 and 10"

	end if

else

response.write "x does not fall between 1 and 10"

end if





should work...



regards

Dave



-----Original Message-----

From: Andrew Matheson [mailto:amatheso@y...]

Sent: 06 March 2002 16:55

To: Access ASP

Subject: [access_asp] test to see if a value is in a range





Hi.



I have a simple prob.  I want to take a variable and test it to see if it 

fits in a range.



ie i take the value x and assign it a value



the code i want to get working is:



   If x >=1 AND <=10 then



       response.write "x falls between 1 an 10"



   Else



       response.write "x Dose Not fall between 1 an 10"



   End If



This is  a more simple version of what i am trying to do.  However i just 

want to know exactly how to write the code correctly in ASP. is the 

compariative bit correct.  I can't get it working??!





Please Help!



regards



Andrew






Message #3 by "Zee Computer Consulting" <zee@t...> on Wed, 6 Mar 2002 10:17:47 -0800
Actually, an IF construct can use a compound condition:



    IF ( x >= 1 ) AND ( x <= 10 ) THEN

        Response.Write "x falls between 1 and 10"

    ELSE

        Response.Write "x does not fall between 1 and 10"

    END IF





-- Zee









----- Original Message -----

From: "Dave Savage" <dave@t...>

To: "Access ASP" <access_asp@p...>

Sent: Wednesday, March 06, 2002 9:08 AM

Subject: [access_asp] RE: test to see if a value is in a range





> ASP IF statements can only accept one argument.

> Try:

>

> if x >= 1 then

> if x <= 10 then

> response.write "x falls between 1 and 10"

> end if

> else

> response.write "x does not fall between 1 and 10"

> end if

>

>

> should work...

>

> regards

> Dave

>

> -----Original Message-----

> From: Andrew Matheson [mailto:amatheso@y...]

> Sent: 06 March 2002 16:55

> To: Access ASP

> Subject: [access_asp] test to see if a value is in a range

>

>

> Hi.

>

> I have a simple prob.  I want to take a variable and test it to see if it

> fits in a range.

>

> ie i take the value x and assign it a value

>

> the code i want to get working is:

>

>    If x >=1 AND <=10 then

>

>        response.write "x falls between 1 an 10"

>

>    Else

>

>        response.write "x Dose Not fall between 1 an 10"

>

>    End If

>

> This is  a more simple version of what i am trying to do.  However i just

> want to know exactly how to write the code correctly in ASP. is the

> compariative bit correct.  I can't get it working??!

>

>

> Please Help!

>

> regards

>

> Andrew

>




$subst('Email.Unsub').

>




$subst('Email.Unsub').




  Return to Index