Subform linked to combo box

L

LindaL.

I placed a combo box on my main form that gets it's data
from another subform on the main form a.e. SELECT Room
FROM qryBuildingRoom WHERE BuildingID = [Forms]!
[frmFacilityRealEstate]![sbfrmBuilding]![BuildingID]. Now
I want to link a subform to this combo box. I want the
subform to show the data for the BuildingRoomID I have
chosen in the combo box. The field that they have in
common is BuildingRoomID. I have tried everything to get
the subform to work along with the combo box and nothing.
For the Link CHILD FIELD I used: BuildingRoomID
For the Link MASTER Field: SELECT Room FROM
qryBuildingRoom WHERE BuildingID = [Forms]!
[frmFacilityRealEstate]![sbfrmBuilding]![BuildingID];
I keep coming up with a Syntax Error. Can someone help
 
K

Kelvin

You cannot use a Select statement for the master/child field. If all you
are trying to do is show the building info, just make the subform liked to a
query that uses the combo box as the criteria, then on the AfterUpdate event
of the combo box, have it requery the subform. You don't even need a
subform to do this either. Just add all the buildinf info into the Select
statement for the combo box then add text boxes to your main form that is
populated on the AfterUpdate event of the combo box. i.e. txtAddress =
cmbBuilding.Column(1) assuming the address in the second column in the
select statement.

Kelvin
 

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