G
Guest
Can anyone advise how I enter criterion 'if field not blank' in a query -
e.g. If MyField not blank "1202=MyField".
Thanks
Dudley
e.g. If MyField not blank "1202=MyField".
Thanks
Dudley
Ofer said:If you want to replace the Null (blank) value, with another value then use
the NZ function
Nz([MyField],0) ' will replace the null with 0, you can replace with any
other value.
The other way is to use the iif.
iif(isnull([MyField]),0,[MyField]) ' If the value of my field is null it
will replace it with 0, other way get the value of myField
Dudley said:Can anyone advise how I enter criterion 'if field not blank' in a query -
e.g. If MyField not blank "1202=MyField".
Thanks
Dudley
Dudley said:Thanks for the advice, but I do not want to replace blank with a value,
rather to enter specified text when the field is not blank e.g.
If surname field is blank leave it blank
If surname field has "Smith" enter text "6102=Smith"
I assume this would be something like
Iff(([Surname],isnotblank),("6102"[Surname])) but I do not know what to put
for the isnotblank.
Dudley
Ofer said:If you want to replace the Null (blank) value, with another value then use
the NZ function
Nz([MyField],0) ' will replace the null with 0, you can replace with any
other value.
The other way is to use the iif.
iif(isnull([MyField]),0,[MyField]) ' If the value of my field is null it
will replace it with 0, other way get the value of myField
Dudley said:Can anyone advise how I enter criterion 'if field not blank' in a query -
e.g. If MyField not blank "1202=MyField".
Thanks
Dudley
Ofer said:Try this
IIF(not isnull([Surname],"0612" & [Surname])
Dudley said:Thanks for the advice, but I do not want to replace blank with a value,
rather to enter specified text when the field is not blank e.g.
If surname field is blank leave it blank
If surname field has "Smith" enter text "6102=Smith"
I assume this would be something like
Iff(([Surname],isnotblank),("6102"[Surname])) but I do not know what to put
for the isnotblank.
Dudley
Ofer said:If you want to replace the Null (blank) value, with another value then use
the NZ function
Nz([MyField],0) ' will replace the null with 0, you can replace with any
other value.
The other way is to use the iif.
iif(isnull([MyField]),0,[MyField]) ' If the value of my field is null it
will replace it with 0, other way get the value of myField
:
Can anyone advise how I enter criterion 'if field not blank' in a query -
e.g. If MyField not blank "1202=MyField".
Thanks
Dudley