I have a table containing addresses with a separate field for
State. Is there a way to create a query that returns an unique
list of the states in that table and still be updateable? I tried
setting the unique values property to Yes but that gave me a
recordset that was not updateable.
Why would you want that?
Of course it can't be updatable, because each row in the resultset
represents one or more records.
If you want to regularize data that has been entered inconsistently,
you have two choices:
1. manual: sort the data by the state field and go through and cut
and paste the corrected values. For a couple of thousand records
this may be enough, especially if the number of bad values is small.
2. lookup table: take your unique query and turn it into a MakeTable
to create a temp table with the unique values. After you've run it,
edit the table to add a new column for the corrected value. It would
look something like this:
State NewState
AK
AL
IL
Ill IL
OH
Ohio OH
The first column lists the unique values from the original data
table, and the second column you'll fill out only the values you
want to change.
Then put an index on the first column (it should be unique), and
create an update query that joins the first column to the State
column in your source data table. In the criteria row of the second
column, put in Not Null, and have the update value be the second
column (e.g., [NewState]).
To keep your data regular, you also have two choices:
1. create a State lookup table and use a combo box in your forms to
choose from the State combo box.
2. create a combo box on the unique values already in the State
field. However, if you're going to turn on LimitToList, this makes
little sense, as it's only really useful for fields where you're
likely to be adding values but don't want to maintain a lookup table
(City might be a candidate for this kind of lookup).