Ian,
Good to see progress so far... although I note you did not take my
previous recommendation to dispense with the CountryID field.
Ok, next step is that your comboboxes should not be Country, State,
City. They should be CountryID (if you choose to persist with this idea
of having a CountryID field), StateID, and CityID. You can set the
comboboxes up so that it is the State, City, etc values that you see,
but it is the ID values that they work with. For example, you can set
these properties of the StateID combobox:
Column Count: 2
Bound Column: 1
Column Widths: 0;x (where x is however wide you need it to be to show
the widest state name)
Then, here's an example: Make a query based on the City table, and in
the Criteria of the StateID column put the equivalent of...
[Forms]![NameOfYourForm]![StateID]
Then, make this query the Row Source of the CityID combobox.
Then, on the After Update event property of the StateID combobox, enter
"Event Procedure", click the little ellipsis (...) button to the right
of the property box, which will open the VB Editor window, and in the
space between the Private Sub and End Sub lines, type this...
Me.CityID.Requery
After this, what should happen is that when you select a State in the
StateID combobox, the CityID combobox should only list cities in the
selected state. If you want the cities list to be immediately
displayed, expand the code like this...
With Me.CityID
.Requery
.SetFocus
.DropDown
End With
--
Steve Schapel, Microsoft Access MVP
ian said:
Thanks steve i have made the changes in the daabase where should i post to
get some assistance
I am new to this
I have a database that I want to make better.
In a form I have the following comboboxes:
Country, State, City
I have 3 tables named
1 Country = CountryID - Country
2 State = StateID – State –CountryID (foreign key country) 1 to many country
to state
3 City = CityId – city- stateID (foreign key state) 1 to many state to city
When I select the country (USA) I want the states to appear
When I select the state I want the cities to appear
Please and thanks