G
Guest
I am using an update query to clean up really messed up data I receive. I
receive large chunks of sloppy, unformatted, date, where years of dates are
not always correct, among other problems. In table TnewData I start all data
in text fields, along with a duplicate set of empty fields with proper
datatypes in the same table.
Then, using subqueries to fix certain data problems, like to calculate the
proper year a date should have, I update the results to the corresponding
empty field of the proper field type . But, I am having trouble with the
Customer Name expression. In column CustomerRaw, a single Customer name can
be entered several different ways.
For instance, "Chachi's Hog Hut" is sometimes entered as
"CHH" or
"Chachis Hog Hut" or
"Chachi's" or
"Chachis" or
"Chachis HH"
So, I created a separate table, TCustomersLookup, where there would be 5
records for this customer:
GoodName, BadName
Chachi's Hog Hut, CHH
Chachi's Hog Hut, Chachis Hog Hut
Chachi's Hog Hut, Chachi's
Chachi's Hog Hut, Chachis
Chachi's Hog Hut, Chachis HH
I've identified all the customer names that are problematic and entered them
in this table.
So, I left join TnewData with TcustomersLookup and use an expression in the
update field. However, Customer always comes out with the same name as
CustomerRaw. So far, I have tried:
DLookUp("[goodName]","TcustomersLookup","badName=customerRaw") WHERE
[customerRaw] = [Tcustomers.Lookup].[badName]
IIf([customerRaw]=[TcustomersLookup].[badName],[TcustomersLookup].[goodName],[customerRaw])
Sometimes the VERY FIRST bad name in my table is converted to the good name
properly, and all the rest of the names are not converted, but most of the
time nothing is converted propertly.
What am I doing wrong?
Thanx
Jeny
receive large chunks of sloppy, unformatted, date, where years of dates are
not always correct, among other problems. In table TnewData I start all data
in text fields, along with a duplicate set of empty fields with proper
datatypes in the same table.
Then, using subqueries to fix certain data problems, like to calculate the
proper year a date should have, I update the results to the corresponding
empty field of the proper field type . But, I am having trouble with the
Customer Name expression. In column CustomerRaw, a single Customer name can
be entered several different ways.
For instance, "Chachi's Hog Hut" is sometimes entered as
"CHH" or
"Chachis Hog Hut" or
"Chachi's" or
"Chachis" or
"Chachis HH"
So, I created a separate table, TCustomersLookup, where there would be 5
records for this customer:
GoodName, BadName
Chachi's Hog Hut, CHH
Chachi's Hog Hut, Chachis Hog Hut
Chachi's Hog Hut, Chachi's
Chachi's Hog Hut, Chachis
Chachi's Hog Hut, Chachis HH
I've identified all the customer names that are problematic and entered them
in this table.
So, I left join TnewData with TcustomersLookup and use an expression in the
update field. However, Customer always comes out with the same name as
CustomerRaw. So far, I have tried:
DLookUp("[goodName]","TcustomersLookup","badName=customerRaw") WHERE
[customerRaw] = [Tcustomers.Lookup].[badName]
IIf([customerRaw]=[TcustomersLookup].[badName],[TcustomersLookup].[goodName],[customerRaw])
Sometimes the VERY FIRST bad name in my table is converted to the good name
properly, and all the rest of the names are not converted, but most of the
time nothing is converted propertly.
What am I doing wrong?
Thanx
Jeny