[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Simple IF NOT Statement

Posted on 2004-04-06
Medium Priority
Last Modified: 2006-11-17
I have this IF NOT Statement:-

<% if NOT varRequest ="All New loads" OR  varRequest ="All New NEW Loads" then%>

<DIV title="Manifest has arrived">M = Manifest has Arrived</div>
<DIV title="Booked out">B = Load Booked Out</DIV>
<DIV title="Arrival of Driver">A = Arrival of Driver</DIV>
<%end if%>

I have also added an OR in the statement, for some reason it does not pick up the second part of the OR statement.

Am I using the incorrect syntax?  
I have tried:-

<% if NOT varRequest ="All New loads" OR NOT  varRequest ="All New NEW Loads" then%>

and this does not work either.

please help
Question by:Pigdogmonster
  • 2
  • 2
  • 2
  • +1
LVL 43

Accepted Solution

TimCottee earned 80 total points
ID: 10765953
Hi Pigdogmonster,

I assume you want:

<% if NOT (varRequest ="All New loads" OR  varRequest ="All New NEW Loads") then%>

Which will display your stuff if neither condition is true.

Tim Cottee
Brainbench MVP for Visual Basic

Expert Comment

ID: 10765987
if both the conditions are checking for not having that value u can use like

<% if varRequest <> "All New loads" OR varRequest <> "All New NEW Loads" then%>

this ll work

Author Comment

ID: 10766035
thats it! thanks.

Do normal IF statements work without the brackets?  i.e

if varRequest ="All New loads" OR  varRequest ="All New NEW Loads" then

These seem to work wothout the brackets?
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

LVL 43

Expert Comment

ID: 10766041

No you cannot, that will actually make it happen every time, need an AND if you are negatively testing two exclusive conditions:

<% if varRequest <> "All New loads" AND varRequest <> "All New NEW Loads" then%>


<% if NOT varRequest ="All New loads" AND NOT  varRequest ="All New NEW Loads" then%>


Expert Comment

ID: 10766163
im sorry timcottee
i dint see that
that should be as u said
that's a mistake

Expert Comment

ID: 10767541
Rajmahesh's solution will always return true:

if varRequest <> "All New loads" OR varRequest <> "All New NEW Loads"

varRequest = "All New loads"  ->  if False Or True  ->  True
varRequest = "All New NEW Loads"  ->  if True Or False  ->  True

What you probably want is

if varRequest <> "All New loads" AND varRequest <> "All New NEW Loads"

Pigdogmonster, the brackets <> mean "is not equal to".  the condition can also be stated this way:

if Not varRequest = "All New loads" AND Not varRequest = "All New NEW Loads"

or even:

if Not (varRequest = "All New loads" OR varRequest = "All New NEW Loads")

the reason for the OR in the last version is that using the NOT outside the brackets changes the AND to an OR

Expert Comment

ID: 10767564
oops... I don't know why I didn't see the two comments above mine... never mind me :|

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month20 days, 6 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question