I\'m running a really simple query, however for some of the results the value in one field is null. How can I set that value to \"a string\" if its value is null?
Someth
To avoid some problems to other users :
Problem 1 + Solution :
If you are planning to use the ISNULL
function with an Access Database, be aware of the fact that the ISNULL
function implemented in Access is differrent from the SQL Server implementation.
Access ISNULL
function always returns TRUE
or FALSE
.
So you have to use a custom IIF
function around your ISNULL
usage.
Problem 2 + Solution :
Moreover, if you wish to use the same field name as Alias for your column, this could lead the Access Database Engine to inform you that there is a "circular reference" to the field.
So if you need to use the same field name as Alias, you just have to add the table name before the field name. (example : You have to use RegTakePart.Website
instead of simply Website
). This way, you can freely use Website
as Alias name for your column.
The global working (and tested) SQL query to avoid these 2 problems is the following one :
SELECT RegName,
RegEmail,
RegPhone,
RegOrg,
RegCountry,
DateReg,
IIF(RegTakePart.Website IS NULL, 'no website, RegTakePart.Website) AS Website
FROM RegTakePart
WHERE Reject IS NULL