Update a field using another field from the same table

Never Hide

Registered User.
Local time
Today, 04:04
Joined
Dec 22, 2011
Messages
96
Hello everyone,
I have a table in which I store date about cities. Among other fields, there are two fields Title_1, Title_2 and both refear to the City's name,
Title_1 has the city's name and Title_2 has an abbrevation of that city's name.
In Title_2 there are some records that are null cause an abbrevation for that city doesn't exists. What I'd like to do is whenever there is a empty record in Title_2 to be replaced with the corresponding entry in Title_1. So basically something like this
Code:
If (Title_2=null) Then 
Title_2=Title_1
Else
Title_2=Title_2
What I've tried is this
In an Update query I selected the Title_2 field and in "Update to" I used this
Code:
IIf([Title_2] Like "Is Null";[Title_1];[Title_2])
But when I run the query and check the table afterwards, no change has been made.
Am I thinkig this the wrog way?
Any ideas are greatly appreciated :)
 
One of:
Code:
Nz([Title_2], [Title_1])

IIF(Len([Title_2] & "") <> 0, [Title_2], [Title_1])
 
Cheers, worked like a charm :D
Thaks a lot :D :D
 

Users who are viewing this thread

Back
Top Bottom