M
Marcia
I have various "Homes" where "Residents" live within various
"Locations" within the Home. These locations vary among the homes;
for example, the River Home may have "East" and "West," while the
Brook Home has "North" and "South."
From my Residents form, I want to choose their Home through a combo
box, and when I click on a second combo box (Location) I want to see a
filtered list of the locations that apply only to the
previously-chosen Home.
Based on the following list of tables and fields, I have been able to
accomplish this, **EXCEPT** the second combo will not update the
filter after I have first clicked on it without closing and re-opening
the form. I want the combo to update automatically every time I
change records.
My tables/form setup and code is as follows:
Tables and Fields:
Table: HOMES:
fldHomeID
fldHomeName
Table: HOMELOCATIONS:
fldHomeLocID (autonumber)
fldHomeLocation (text)
fldHL_HomeID (number)
Table: RESIDENTS:
fldRes_HomeID
fldRes_HomeLocation
Form: frmRESIDENTS:
cboRes_HomeName (combo that displays
Homes.fldHomeName, &
stores Homes.fldHomeID in
Residents.fldRes_HomeID)
cboHomeLocation (combo that displays
HomeLocations.fldHomeLocation, & stores
HomeLocations.fldHomeLocID in
Residents.fldRes_HomeLocation)
First ComboBox (cboRes_HomeName):
In the "After_Update" event, I entered the following code:
Private Sub fldRes_HomeID_AfterUpdate()
Forms!frmResidents!cboHomeLocation.Requery
End Sub
Second ComboBox (cboHomeLocation):
In the "Row Source" property, I entered the following SQL query:
SELECT DISTINCT tblHomeLocations.fldHomeLocID,
tblHomeLocations.fldHomeLocation
FROM tblHomeLocations
WHERE (((tblHomeLocations.fldHL_HomeID)=[Forms]![frmResidents]!
[fldRes_HomeID]))
ORDER BY tblHomeLocations.fldHomeLocation;
Does anyone know what I'm doing wrong?
Thanks,
Jessi
"Locations" within the Home. These locations vary among the homes;
for example, the River Home may have "East" and "West," while the
Brook Home has "North" and "South."
From my Residents form, I want to choose their Home through a combo
box, and when I click on a second combo box (Location) I want to see a
filtered list of the locations that apply only to the
previously-chosen Home.
Based on the following list of tables and fields, I have been able to
accomplish this, **EXCEPT** the second combo will not update the
filter after I have first clicked on it without closing and re-opening
the form. I want the combo to update automatically every time I
change records.
My tables/form setup and code is as follows:
Tables and Fields:
Table: HOMES:
fldHomeID
fldHomeName
Table: HOMELOCATIONS:
fldHomeLocID (autonumber)
fldHomeLocation (text)
fldHL_HomeID (number)
Table: RESIDENTS:
fldRes_HomeID
fldRes_HomeLocation
Form: frmRESIDENTS:
cboRes_HomeName (combo that displays
Homes.fldHomeName, &
stores Homes.fldHomeID in
Residents.fldRes_HomeID)
cboHomeLocation (combo that displays
HomeLocations.fldHomeLocation, & stores
HomeLocations.fldHomeLocID in
Residents.fldRes_HomeLocation)
First ComboBox (cboRes_HomeName):
In the "After_Update" event, I entered the following code:
Private Sub fldRes_HomeID_AfterUpdate()
Forms!frmResidents!cboHomeLocation.Requery
End Sub
Second ComboBox (cboHomeLocation):
In the "Row Source" property, I entered the following SQL query:
SELECT DISTINCT tblHomeLocations.fldHomeLocID,
tblHomeLocations.fldHomeLocation
FROM tblHomeLocations
WHERE (((tblHomeLocations.fldHL_HomeID)=[Forms]![frmResidents]!
[fldRes_HomeID]))
ORDER BY tblHomeLocations.fldHomeLocation;
Does anyone know what I'm doing wrong?
Thanks,
Jessi