PMFBI
there are several functions in Access
that will choke on a Null--Trim() is
one of them.
To make a string field "null-safe"
so you can use in your query,
one method is to use a *concatenating*
ampersand (not boolean operator)
with a zero-length string
[stringfield] & ""
the amperand will ignore any
null on the left, and return a
zero-length string if it is null.
if it is not null, you are still going
to get the exact same field string.
you lucked out and did not *really*
have a field with a null value apparently
or your query as you changed it would
have choked on the Trim function.
Poppacat said:
That worked well, but I'm a bit forrgy about part of the expression. I
used
this variation:
Name1 & IIF(Trim(Name2)="","","/ " & Name2)
and got the same results. What does the extra boolean operator acomplish?
Thanks,
David Holt
aka Poppacat
John Spencer said:
From your posting I would guess that Name2 is not null but is string with
zero
to many spaces.
Try the following
Name1 & IIF(Trim(Name2 &"")="","","/ " & Name2)
That will take care of Nulls, zero-length strings, multi-space strings.
I have two name fields, name1 and name2. Every record has name1, some
records
have name2.
I want a combined field that looks like:
name1
or
name1 / name2
I've tried "[name1] & ("/ " + [name2])"
but when the name2 field is empty I get
name1 /
This thing is killing me!
Any words of wisdom will be greatly appreciated.