[AccessD] List all tables and their fields

Stuart McLachlan stuart at lexacorp.com.pg
Fri Mar 24 06:08:24 CDT 2023


On 24 Mar 2023 at 3:54, Arthur Fuller wrote:

> upside down addresses (this is one I get a lot of
> flak on, but I stand my ground:
...
> In the app I'm currently working on, whose old model used to
> have separate columns for City and State, and no lookups, thereby
> enabling all sorts of nonsensical entries such as Nome, Alabama. So I
> ask for the state or province first, and then I can restrict the list

That's standard for anyone who understands relational database design, 
and the use of cascading comboboxes.

A standard set of tables should look something like:

tblCountry:
CountryPK
CountryName

tblProvince
ProvincePK
CountryFK
ProvinceName

tblCity
CItyPK
ProvinceFK
CityName

(in some applications here, there are also tblDistrict, tblLLG and tblWard between Province 
and City.)

Then we have a series of comboboxes which cascade from the top level division:

Private Sub cboProv_Change()
If cboProv <> ProvName Then 
    cboDist = ""
    cboDist.Requery
    cboLLG = ""
    cboLLG.Requery
End If
ProvName = cboProv
End Sub

Private Sub cboDist_Change()
If cboDist <> DistName Then
    cboLLG = ""
    cboLLG.Requery
End If
DistName = cboDist
End Sub

Private Sub cboDist_Enter()
DistName = Nz(cboDist, "")
cboDist.Requery
End Sub







More information about the AccessD mailing list