p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

proasp_codeclinic thread: whats wrong w/ this code?

Message #1 by "Jacobson, John" <jacobs35@c...> on Fri, 2 Mar 2001 09:32:22 -0500
I always liked:

If (var & "") = "" then
	'value is null or empty
End if

-----Original Message-----
From: Owen Mortensen [mailto:ojm@a...]
Sent: Friday, March 02, 2001 2:39 PM
To: Code Clinic
Subject: RE: whats wrong w/ this code?

OK, the real answer here... (From the O'Reilly book _VB & VBA In A Nutshell_
by Paul Lomax)...

"IsNull is the only way to evaluate and expression containing a null.  For
example, the seemingly correct statement:

If varMyVar = Null then

always evaluates to False, even if varMyVar is null.  This occurs because
the value of an expression containing Null is always Null and therefore

Also, from the _Microsoft Visual Basic 6.0 Language Reference_ by Microsoft

"Expressions that you might expect to be True under some circumstances, such
as If Var = Null and If Var <> Null, are alwasy False.  This is because any
expression containing a Null is itself Null and, therefore, False."


-----Original Message-----
From: JOHN P. PARLATO [mailto:jparlato@m...]
Sent: Friday, March 02, 2001 3:38 PM
To: Code Clinic
Subject: RE: whats wrong w/ this code?

No - it not the same.... since isnull is a function.. it is passed the
argument inside the parens and then returns a true or false.  if you do the
later form, I don't know what you will get... your not talking to you mom,
you calling a function.

  Return to Index