Print Page | Close Window

If then else statement using ’OR’

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=11071
Printed Date: 31 March 2026 at 3:07pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: If then else statement using ’OR’
Posted By: Agni
Subject: If then else statement using ’OR’
Date Posted: 02 July 2004 at 11:18am

I am trying to write an if else statement, but with an or condition as follows (which doesn't work!) 

If strCategory="Corfu" or "Site Admin" then

...

End If 

 

Any sugestions would be very helpful.

Thanks

Nathan

 



-------------
www.agni.gr
Travel To Greece Guide



Replies:
Posted By: zaboss
Date Posted: 02 July 2004 at 11:20am

If strCategory="Corfu" or strCategory="Site Admin" then



-------------
Cristian Banu
http://www.soft4web.ro - Soft 4 web


Posted By: Semikolon
Date Posted: 02 July 2004 at 11:26am
are you the same Nathan that has been here before? the one who drinks beer and hosts with JH?

You have to use the variable between all operators like zaboss wrote..

If intVariable = 1 OR intVariable = 2 AND intVariable2 = 5 THEN


Posted By: Gullanian
Date Posted: 02 July 2004 at 11:39am
Using () helps when mixing ORS with ANDS


Posted By: Semikolon
Date Posted: 02 July 2004 at 11:41am
shoot.. forgot..

If you want it to be either var 1 = 1 Or var1 = 2 and var 2 = 5 then you have to do it like this:

If intVariable = 1 OR (intVariable = 2 AND intVariable2 = 5) THEN


Posted By: Agni
Date Posted: 02 July 2004 at 12:00pm

Yes correct SemiKolon. I tried a while back to change my email address in my profile, but must have incorrectly entered it as it does not send me an activation email - so I am unable to log into my old account.

Re Beer - yep I drink loads - especially after Greece winning the football last night!

RE coding -

if strCategory="Corfu - Greece" then

(works fine)

 If strCategory="Corfu" or strCategory="Site Admin" then

(throws an error)

Not sure why, and I cannot tell you which error it is throwing as all error codes display my site map page!

Any help would be very welcome.

Nathan

 



-------------
www.agni.gr
Travel To Greece Guide


Posted By: Semikolon
Date Posted: 02 July 2004 at 12:17pm
try if strCategory="Corfu - Greece" or strCategory="Site Admin" then then


Posted By: Agni
Date Posted: 02 July 2004 at 4:31pm

Thanks - my fault sorry - the problem is not with the expression, but the coding run when the if statement is true! - Thanks for all you help though - again I owe everyone beers!

Cheers

Nathan

Taverna Agni, Corfu



-------------
www.agni.gr
Travel To Greece Guide



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net