Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If else

Status
Not open for further replies.

A1Pat

IS-IT--Management
Jun 7, 2004
454
US
Could someone tell me what is wrong with this:

if totalShipItems = 0 AND (shippingLocState <> "AK" OR shippingLocState <> "HI") then

thanks.
 
That depends on what you what that line to do and what the values in the variables are at the time of conditioning

in short...nothing is wrong with it. it is doing exactly what it says to do

General FAQ faq333-2924
5 steps to asking a question faq333-3811
 
Logical Operators

Check your OR and what I'm assuming you really want returned from that line.

Next time though please be a bit more detailed in your question.

General FAQ faq333-2924
5 steps to asking a question faq333-3811
 
The second part of the condition is always true, thus the value of shippingLocState has no effect.

Possibly you wish to test for zero items and not to Alaska and not to Hawaii? Meaning that when shipping zero items to AK or HI skip this block, but shipping zero items anywhere else, then do this block.
Code:
If Not (shippingLocState = 'AK' OR shippingLocState = 'HI' ) And totalShipItems = 0 Then 
...
Else
...
End If

Logic my dear Watson.
 
wouldn't it be clear and let of a mess with the operators to just

totalShipItems = 0 AND (shippingLocState <> "AK" AND shippingLocState <> "HI")

In the ( ) being clear syntax only and having not much meaning then

General FAQ faq333-2924
5 steps to asking a question faq333-3811
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top