Discussion on:

14
Comments

Join the conversation!

Follow via:
RSS
Email Alert
Have you ever run into problems caused by someone who neglected to accommodate null values? Are there any additional situations where you've had to work around or proactively handle null values to prevent errors?
0 Votes
+ -
It's just that easy.
Darn, now I'm going to have to do some more homework. And I thought I had explained that, to somebody, once.
In the old days (even before M$ exclude) we solve that with 0.0 and with a '+' or '-' before a number. Later with a '$' for monitary sum.
The rest of that solution is some where in my old memory bank poluted with a lot of coffee. It will come back to me though. Was this a test of some sort? Geeze I think I seen this some where else.
cool
0 Votes
+ -
Hmm
Tony Hopkinson 12th Oct 2006
Where not(source.field) is null
does not make any sort of sense to me

Where not source.field is null

Or

Where not (source.field is null)

in proper SQL you might find a use for the NullIf function which is a sort of inverse of IsNull

NullIf(Source.Field,0)

useful if someone in the past got round a nullability problem by putting rubbish in the field.
0 Votes
+ -
That's not designed to be code, but rather the parens are used to indicate that a feild name is inserted in that location within the line of code. The line of code would read as either of your options--though the latter would likely make it cranky.

Access generates SQL code, but it's not the cleanest line.
0 Votes
+ -
Access SQL
jkowolf 22nd Nov 2006
If you build a query in Access and put 'Is Not Null' in the criteria row under the field you want to exclude nulls, Access builds the SQL statement like this:
SELECT Fee_Account
FROM tbl_Account
WHERE (((Fee_Account) Is Not Null));

Not saying the other way won't work, but this does and seems to make sense. I don't know if it proper or not.
I have to compare two identical tables for indifferences but the NULLS are not being found. Does this logic make sense of should it be coded differently?

WHERE ((([TABL_1]![TEMPB])[TABL_2]![TEMPB])) OR ((([TABL_1]![TEMPB]) Is Not Null) AND (([TABL_2]![TEMPB]) Is Null));
as null = null then it gets messy

Where (NOT (f1 is null) and (f2 is null))
or ((f1 is null) and (f2 is not null))
or ((f1 is not null) and (f2 is null))
or ((f1 is not null) and (f2 is not null) and (f1 f2))

Another way is to use the isnull function, it's a bit naughty depends on how whatever uses the data treats nulls.
for instance if nulls in an integer field are treated as zeros in the application then

isNull(f1,0) isnull(f2,0) would do the job, if you want to say the NULL = 0 !

you could use another value instead of zero e.g. -1 given that - 1 should never be in the column.

HtHs
Have a field with no value can I use IsNull to highlight that field & use conditional format
0 Votes
+ -
IsNull([SomeField],'Unknown')
in a condition might as well just use
([SomeField] is null)

If it's you want 'unknown' on the report and to do some condtional output, then by all means.
0 Votes
+ -
Thanks Tony- I figured it out. After thinking about what I wanted to do last night, I decided to format the field to have a background color automatically and then I used conditional formatting to take the background color away if it met the opposite criteria (ie: if it contained a date.) It gave me what I wanted, Thanks for your help.
0 Votes
+ -
Null Values
RAAGHAVAN 21st Aug 2011
Really a beautiful solution I could find here. I was having the problem of selecting the null values along with dates and I was getting blank reports. Now with the suggested solutions, I could solve the problem in a friction of second. Thanks a lot.
Hello to all. hmm what is the possible code to use when I want to retrieve null values of access in listview (visual basic6) I try nz funtion but it doesnt work. Could anyone help me or teach me how to start to code.

Thanks in advance for every input here.
Ask in questions, and post a bit of the code.
Oh and why are you still using VB6?
Keyboard Shortcuts:
Prev
Next
Toggle
Join the conversation
Formatting +
BB Codes - Note: HTML is not supported in forums
  • [b] Bold [/b]
  • [i] Italic [/i]
  • [u] Underline [/u]
  • [s] Strikethrough [/s]
  • [q] "Quote" [/q]
  • [ol][*] 1. Ordered List [/ol]
  • [ul][*] · Unordered List [/ul]
  • [pre] Preformat [/pre]
  • [quote] "Blockquote" [/quote]

Join the TechRepublic Community and join the conversation! Signing-up is free and quick, Do it now, we want to hear your opinion.