I want to build a database for people's names.
The fields are these:
First name
Middle name
Last name
DOB
State of birth
County of birth
City of birth
The problem is with the last three items.I want to make a pick list for the state, county, and the city. No problem with the state. Just created a table with one text field and filled it up with states. Here is the Constructor view of the table.
Then I created a table for state counties. Here is its Constructor view.
Here, the county field is a simple text type, but the state field is of the lookup type.
The reason for this is that when entering a county in the table, I want to pick up its state from the list of states in the combo box (the states in it being sourced from the tblStates table) as is shown here:
As a result, my table tblStates ended up looking like this:
That's not a problem, and I would say it's even a plus. I haven't figured out yet the way this relation works, though.
But it's not important as far as my problem is concerned. At least, I don't think it is.The problem starts with the people's table. Here is what it looks like:
To be exact, all counties for all states are available for picking, instead of only counties for the selected state, which is Alabama in this case.
The constructor view for the birthCounty field of this table is this:
(The forum won't let attach more than 5 images, so I am including the rest as URLs)
https://my.pcloud.com/publink/show?c...eQCizJwj3yYzvy
The birthState field type is also of the lookup type from the tblStates table. It works without any problems, as this table has no connected tables.
So, my question is, how can I get only the counties for the selected state to show in the pick list for the birthCounty field?
(Here, I included both columns in the pickup list for demonstration purposes only, so as to make it easier to see that counties for all states are in the pick list.)
I believe there is a solution to this problem. I think I did a similar project long time ago (about 15 years ago), and I was able to filter out the pick list, limiting it only to the criteria in another field. At least I think I did. But it was so long ago that now I don't remember how I did it.
And here is what my tblPeople table winded up looking like:
https://my.pcloud.com/publink/show?c...xinryp5uURAgTy
And here are the final relationships:
https://my.pcloud.com/publink/show?c...E8onT5zBtVIozX
Funny, there is no relationship between the tblStates table and the tblCounties table, even though in the latter I am picking states from the former.