Concat two columns in a SELECT with NULL (Access)

  • Thread starter Thread starter Martin Rothschink
  • Start date Start date
M

Martin Rothschink

Hi,

to concat two columns in Access I can use + or &. If I use + the NULL
pushes through, so I want to use &.
Example: SELECT Firstname & ' ' & Lastname AS Name ...

Problem: The OleDbCommand object doesn't accepts & in a SQL statement,
only + is allowed.

But now I get empty data if Firstname is NULL.

Does anybody know the trick?

Regards
Martin
 
Hi Martin

You should check if given field is null - did not read it, but I suppose
concatenation of strings, where one of them is null gives you null?
Use following construct (was in help)

select IIf(IsNull([Firstname]), " ", [Firstname]) ...

Peter
 
Back
Top