Fill a Null Value with details from another column

Trisha

Registered User.
Local time
Today, 03:27
Joined
Jan 24, 2013
Messages
18
I was hoping someone would be able to help me, i want to create an sql expression or even use the expression builder that will if Column A has a Null Value replace with the data from another Column-B
i have tried to use the if statement as below
IIf(Column_A=null (Column_B),(Column_A))
but this keeps giving me syntax and parenthesis errors

i am not the best when it comes to if statements
 
Hey Trisha, welcome to the forum,

Null is a special value the we can't test for using the equals sign. Instead there is a function called IsNull(), so you could amend your expression as follows ...
Code:
IIf(IsNull(Column_A), Column_B, Column_A)
Cheers,
 
HI lagbolt,

Thanks for the welcome,
Well i have used that statement as you suggested and i have removed brackets and inserted them and i still seem to be getting the same error "The expression you entered has a function containing the wrong number of arguements" :banghead: any suggestions as to what i am doing wrong
 
Why not simply use a Nz()?
Code:
Nz(ColumnA,ColumnB)
Nz, works as a simplified If, checking for Null values as the condition.. If the value in the first argument is null it will place the second argument as result.. Else just keeps the first argument..
 
Yeah, the Nz() function is a good choice to. If you having problems with syntax, then post exactly the syntax you are using and what there error is. Otherwise there's not enough info to troubleshoot.
 
The Nz() function Worked a treat, thanks guys for the help
 

Users who are viewing this thread

Back
Top Bottom