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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is Not Equal To Nothing?

Status
Not open for further replies.

BarryMVS

IS-IT--Management
Apr 17, 2003
172
GB
Hi all,

I'm trying to put together an ASP check to make sure that a set of variables contain the correct data before proceeding.

I have three data variables, (v1, v2 and v3), and I want make sure that v1 and v2 contain data if v3 does.

I have tried the following:
Code:
if v1 or v2 = "" and v3 <> "" then
but this didn't work, (Type mismatch) so I tried:
Code:
If v1 or v2 = Null and v3 <> Null then
but this errored also.

The variables contain peoples names, but I can not get it to give me the result I'm after.

Any ideas most welcomed.

Thanks,

Barry

ICT Network Administrator
IT Services Manager
 
each variable has to be checked seperately

addition in red
Code:
if v1 [red] = ""[/red] or v2 = "" and v3 = ""





Chris.

Indifference will be the downfall of mankind, but who cares?
A website that proves the cobblers kids adage.
Nightclub counting systems

So long, and thanks for all the fish.
 
Cheers Chris.

Solved the problem.

Can't believe I didn't think of it!


Barry

ICT Network Administrator
IT Services Manager
 
Just as an additional side thought, when checking for null, you should check to see if it is null, not = null. This is never true: Null = Null. Instead, it should read:
Code:
if isnull(v1) 'Since there actually is a built-in ASP function for this.
.

------------------------------------------------------------------------------------------------------------------------
"The major difference between a thing that might go wrong and a thing that cannot possibly go wrong is that when a thing that cannot possibly go wrong goes wrong it usually turns out to be impossible to get at or repair."
--Dou
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top