puzzle...

ariel81

Registered User.
Local time
Today, 08:49
Joined
Dec 31, 2006
Messages
75
i have this code:
Code:
 If IsNull(rs![tblFltTotalJobsAE] Or rs![tblFltTotalJobsEI] Or rs![tblFltTotalJobsRC]) = False Then
             a = a + rs![tblFltTotalJobsAE]
             b = b + rs![tblFltTotalJobsEI]
             c = b + rs![tblFltTotalJobsRC]
             d = a + b + c
             
          
                 f("test2") = d
            
              End If

the result of the abv code eg:
rs![tblFltTotalJobsAE] <- 2
rs![tblFltTotalJobsEI] <- 3
rs![tblFltTotalJobsEI] <- 4
f("test2") = 9 , the result will be 9 (correct!)

if any of the rs![ ] is a null,
rs![tblFltTotalJobsAE] <- 2
rs![tblFltTotalJobsEI] <-
rs![tblFltTotalJobsEI] <- 4
f("test2") = **empty data** , the result should be 6 but the textbox is blank.

why the abv code doesn't seems to add up records whenever any of the records is empty?
 
Null isn't the same as zero. Look at the Nz() function.
 
If IsNull(rs![tblFltTotalJobsAE] Or rs![tblFltTotalJobsEI] Or rs![tblFltTotalJobsRC]) = False Then

this will always return false as you are asking a logic question and you will get either a 0 or 1 retuned by the brackets

Peter
 
Peter,
I can't come up with a test right now but I believe *any* non 0 value will be interpreted and a True.
 
Just done a quick check
Code:
Dim a, b, c
Dim d As Boolean
d = (a Or b Or c)
Debug.Print d

Prints False

Peter
 
The point really is that the logic test will give 1 or 0 so isnull will alway answer False

Peter
 
Hi Peter,
Try this one:
Code:
Dim a, b, c
Dim d As Boolean
a = 1
d = (a Or b Or c)
Debug.Print d
 
Hi Peter,
How about:
Code:
Dim d As Boolean
d = IsNull(Null Or Null Or Null)
Debug.Print d
 
oop :(
Always thought a variant was a null not an "" before it was assigned.

Suppose that this is a case of Nulls propagating again, but then why does it not always end up with a null

Peter
 

Users who are viewing this thread

Back
Top Bottom