Re: Redundency of IsNull(Trim(myvar)) ?

From: Andy (Andrzej7_at_hotmail.com)
Date: 05/20/04


Date: Thu, 20 May 2004 13:02:50 -0700


I think

Trim(myVariable) where myVariable is NULL
will give you an error - Invalid use of Null or something
because you can not Trim NULL.

You can do:
Trim(myVariable & "") where myVariable is NULL

--- Andy

>-----Original Message-----
>Hi,
>
>I am wondering if the following two statements always
yield the same
>results:
>
>1) If IsNull(Trim(myVariable)) Then [...]
>
>2) If IsNull(myVariable) Then [...]
>
>Basically, if myVariable is Null, then won't Trim
(myVariable) also be Null?
>Are there any instances when I would want to leave the
Trim() function in
>the above statement?
>
>Also, are the answers to these questions dependent on
which VBA platform is
>used (i.e. VB6 vs. VBScript)?
>
>Thanks in advance!
>
>JC
>
>
>.
>



Relevant Pages

  • Re: Redundency of IsNull(Trim(myvar)) ?
    ... "Andy" wrote in message ... > will give you an error - Invalid use of Null or something ... > because you can not Trim NULL. ... My guess is that the original code should have been ...
    (microsoft.public.vb.general.discussion)
  • Re: TRIM
    ... TRIM that uselessly does something else. ... was invalid; and that it had to give an explicit ... You are starting to behave as a couple of ...
    (comp.lang.fortran)