Check Multiple CheckBoxes at the same time

G

Gnowor

So I have a list of agents that cover different areas and I want to track
what areas they cover by city and by zip code. I've got 3 tables right now,
the list of agents and their info (phone number, etc.) a list of zip codes,
and a list of cities. I want to link them together so that when I check the
box for Sacramento, it checks the boxes for all zips within Sacramento, or if
I check the box for a zip code within Sacramento, it checks the Sacramento
box (and if the side affect to this is that it checks all zips within
sacramento, I can deal with that). I just have no clue how to accomplish
this. Any advice?
 
D

Duane Hookom

Why are you using check boxes? Can you share your table structures? Check
boxes suggests an un-normalized table structure.
Don't cities and zipcodes have unique and sometimes unrelated values?
 
G

Gnowor

I'm an Access newb and freely admit it. Usually I can pick stuff up pretty
quick but Access is baffling me. When i say checkboxes, I mean each Zip code
is a Yes/No field, and each city is a yes/no field, in two separate tables.
Both tables have a field that Agent ID number, which is related to the Agent
ID in the Agent info table. Hope that's enough info. The end result is that
I want to be able to look up all the info on all the agents that cover a
specific city or zip code. Perhaps there's a more efficient structure that
I've overlooked. Hope that's enough info.
 
D

Duane Hookom

Your Agent Zips should be stored in a table with two fields (or three)

tblAgentZips
==============
AgentID
ZipCode

Each zip code that an Agent is associated with will create a single record
in this table. If an agent is associated with 5 zip codes, there will be 5
records for this agent in the table. The same should be true for the agent
cities.
 
G

Gnowor

Duh. I should've been able to figure that out. So I suppose the solution to
having both cities and zips is to have another Table that translates Zips
into Cities and have a link the zip field together, and use a query to enter
data. Then if I have a city to enter, just leave the zip field blank and
pull it from the city field? Sound correct?
 
D

Duane Hookom

This might be correct. I am not sure of the relationships between cities and
zips.
 
J

John W. Vinson/MVP

Gnowor said:
Duh. I should've been able to figure that out. So I suppose the solution
to
having both cities and zips is to have another Table that translates Zips
into Cities and have a link the zip field together, and use a query to
enter
data. Then if I have a city to enter, just leave the zip field blank and
pull it from the city field? Sound correct?

Since *USUALLY* - not always! - a City will have one or more zipcodes, but
each zipcode will refer to only one (postal service preferred) City, you'ld
usually do it the other way: have a table of Cities and Zipcodes; select the
zipcode and have it automatically display the city. Duane's exactly correct
(as usual!) about the design - storing data (cities or zipcodes) in
fieldnames of yes/no fields is a very bad idea!
 

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