Link to home
Get AccessLog in
Avatar of badgermike
badgermike

asked on

vbscript if statement

Hello,

I have a mulitline vbscript that I use for validation against our accounting software...I am using if elsif sttements - basically I a fine with writing for example if division = x and address = "" then msgbox

what I am having trouble with is a staement like
if division = "x" and state = "AK" and shipmethod is not equal to one of UPS 2 DAY or UPS OVERNiGHT or USPS PRIO then msgbox

sorry if I am not articulating very well basically I am just new to vb sript and am trying to validate all alaska customers to have to have the above three values in their ship via filed or else have a message box thrown - I am not sure if I have to use an array

in crystal reports I can use ex.... if state = "AK" and not(shipvia in ["x","Y","Z"] then yada yada yada...i just don't now how to do this in vbscript..

Thanks
Avatar of sirbounty
sirbounty
Flag of United States of America image

break it down into a full block...makes it more legible, I feel...

if division = "x" Then
 If state = "AK" then
   If shipmethod <> "UPS 2Day" AND shipmethod <> "UPS OverNight" AND shipmethod <> "USPS PRIO" Then
     msgbox
What about this?

Rob.
If division = "x" And state = "AK" And (shipmethod <> "UPS 2 DAY" Or shipmethod <> "UPS OVERNIGHT" Or shipmethod <> "USPS PRIO") Then MsgBox "Hi"

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Holmes199
Holmes199
Flag of United States of America image

Link to home
membership
This content is only available to members.
To access this content, you must be a member of Experts Exchange.
Get Access
Avatar of badgermike
badgermike

ASKER

Perfect!

Thanks!