If you are putting the State name into a City field to distinguish between
cities of the same name in different states then that is not a good design.
In a relational database each city should be represented by a row in a Cities
table with a unique primary key column such as CityID, e.g. an autonumber,
and a text City column. The Cities table should have a State column as a
foreign key referencing the primary key of a States table. As State names
are unique you don't need to use a 'surrogate' numeric StateID primary key
here, though you can if you wish. Two cities of the same name in different
states would be represented by two rows in the Cities table with different
values in the State column. By using normalized tables like this redundancy
is eliminated and the risk of update anomalies arising from the use of
non-normalized tables reduced.
The tblCustomerInfo table would have a numeric CityID column which
references the primary key of Cities. You do not need to store the State in
a separate column in tblCustomerInfo, and moreover should not do so as it
introduces redundancy, as the State is known from the value of CityID. To
count the occurrences of customers in California, you could use an expression
which combined the DCount and DLookup functions, but a better approach would
be to join tblCustomerInfo to Cities in a query then use an expression like
the following:
=DCount("*","YourQuery","City = ""California""")
This assumes you've used State as a 'natural' key rather than a numeric
StateID as a 'surrogate' key. If you use the latter the query would need to
join tblCustomerInfo , Cities and States so that you can refer to the state
by name in the DCount function call as above.
You'll find a demo of various ways of handling this type of geographical
data by using correlated combo boxes at:
http://community.netscape.com/n/pfx...yMessages&tsn=1&tid=23626&webtag=ws-msdevapps
It uses the local administrative areas of Civil Parish, District and County
in my neck of the woods, but the principle is the same.
Ken Sheridan
Stafford, England
[quoted text clipped - 9 lines]