Query Question

S

Staciemcg

I'm a Access newbie, so please forgive my ignorance!
I have a database of Texas companies with a lot of different information.
I'm trying to run a query pulling information from just Dallas & surrounding
cities (I've successfully run it for Houston). My problem is that I'm
getting an error message that says "the express you entered exceeds the
1,024-character limit for the query design grid." There are 116 cities out
of a database of 976 addresses. How do I go about entering these cites in
the criteria? Thank you.
 
D

Douglas J. Steele

Try creating a separate table of cities, with a boolean Selected field in
it. Set Selected = True for those cities that you want, and join it to the
other table.
 
J

John Spencer (MVP)

I would create a second table and populate it with the cities you want and then
use a join between that table and you other table.

OR you could put each city (one time) in the table and associate the city with a
region - if a city would only have one region.

CityRegions (table)
CityName
RegionName

Then you could use the RegionName field to extract the cities in a region.

A way around the limit of 1024 characters might be to set criteria on the field
multiple times and use an In clause to help keep things short. This is NOT the
way I would recommend; I would use the table approach. It is more convenient,
easier to change, and a lot easier to add another city or change a city to
another region.

Field: City
Criteria(1): In ("Dallas","Petticoat", ...)
Criteria(2): In ("Xray","Suburb1","Suburb2"...)
Criteria(3): In (...)

In the SQL view that would look line
SELECT ...
FROM YourTable
WHERE City In ("Dallas","Petticoat", ...) OR
City In ("Xray","Suburb1","Suburb2"...) OR
City In (...)
 
S

Staciemcg

Thanks, guys, the new table and and joining it worked perfectly.
Absolutely love these newsgroups!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top