|
-
Nov 23rd, 1999, 04:08 AM
#1
Thread Starter
Addicted Member
I have this line of code:
ItemListe.SubItems(1) = IIf(Not IsNull(rstRechercheClient!Client_Telephone1), IIf(Not IsNull(rstRechercheClient!FormatPays_Telephone), Format(rstRechercheClient!Client_Telephone1, rstRechercheClient!FormatPays_Telephone), rstRechercheClient!Client_Telephone1), "")
(A little confusing maybe but hey...)
now my problem is that both fiels from my recordset (rstRechercheClient) are NULL... when I get to this line I get a : INVALID USE OF NULL error...
I thought the NOT ISNULL syntax was supposed to avoid that.... what is my problem here ??
-
Nov 23rd, 1999, 04:13 AM
#2
Addicted Member
David,
How about trying something like
itemlist.subitems(1) = "" & rstRe......
or
if you need formating
....= "" & format(rstRe....,"format code")
or
if don't want to load if null
if len(trim(rstRe...)) > 0 then
itemlist.subitems(1) = ....
end if
Hope this helps
-
Nov 23rd, 1999, 04:19 AM
#3
The problem with the IIF Statement is that it validates/evaluates both True and False Arguments regardless of the Result, eg.
Debug.Print IIF(1 = 1, 5 + 5, 10 + 10)
Even though this would always Display 10, it still checks and evaluates 10 + 10.
So even though you check for Nulls in the Expression Part, it still tries to use the Null Value when Validating the False Parameter of your IIF Statement.
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
Nov 23rd, 1999, 04:31 AM
#4
Thread Starter
Addicted Member
Thanks a lot jritchie it's A GREAT idea.... tried it. It works just fine and it's even faster because you can get rid of the IIF's...
Thanks a lot!
-
Nov 23rd, 1999, 04:33 AM
#5
Thread Starter
Addicted Member
Thanks Aaron ... I was wondering why it did that....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|