Combine two fields

P

Peter

There are two fields A and B where A is returned by a
function.

We would like to display A only if B is null OR empty.
And display A/B if B is not empty.
Like:
A = "BB34/2005"
B = "C"
--> Display "BB34/2005/C"

A = BB35/2005
B = Empty or Null
--> Display "BB35/2005"

Thanks
 
J

John Vinson

There are two fields A and B where A is returned by a
function.

We would like to display A only if B is null OR empty.
And display A/B if B is not empty.
Like:
A = "BB34/2005"
B = "C"
--> Display "BB34/2005/C"

A = BB35/2005
B = Empty or Null
--> Display "BB35/2005"

Thanks

In your query put a calculated field:

Display: [A] & ("/" + )

The + operator propagates NULLS, so if is NULL then ("/" + ) is
also NULL. The & operator also concatenates strings, but treats a NULL
as a zero length string.

John W. Vinson[MVP]
 
P

Peter

Dear John,

Thank you for your advice.

Peter
-----Original Message-----
There are two fields A and B where A is returned by a
function.

We would like to display A only if B is null OR empty.
And display A/B if B is not empty.
Like:
A = "BB34/2005"
B = "C"
--> Display "BB34/2005/C"

A = BB35/2005
B = Empty or Null
--> Display "BB35/2005"

Thanks

In your query put a calculated field:

Display: [A] & ("/" + )

The + operator propagates NULLS, so if is NULL then ("/" + ) is
also NULL. The & operator also concatenates strings, but treats a NULL
as a zero length string.

John W. Vinson[MVP]
.
 
Top