Combo Box and Subform

P

PBISMaryland

I am trying to get records in a subform to change based on what is selected
in a combo box.

The combo box's record source is tblstudents with the following fields:
DistrictID
Firstname
Lastname

The subform's record source is tblreferrals with the following fields:
ReferralID
DistrictID
Location
Date
ProblemBehavior

I am trying to link the two objects using the DistrictID field but when I
select a DistrictID in the combo box nothing changes in the subform.

How can I get the subform to change based on what I selected in the combo box?
This may sound silly but does the main form need a record source?

Thanks.
 
A

Al Campagna

PBISMaryland,
Your main form (ex. frmMain) should be unbound, and also the combo box
(ex. cboDistrict)
In the query behind your subform, criteria the DistrictID with...
=Forms!frmMain!cboDistrictID
Set the Parent/Child relationship between the main and the subform as..
Parent = cboDistrict
Child = DistrictID
On the AfterUpdate evnt of cboDistict, Requery the subform to keep the
combo and subform in synch.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
P

PBISMaryland

Worked like a charm.
Thanks.

Al Campagna said:
PBISMaryland,
Your main form (ex. frmMain) should be unbound, and also the combo box
(ex. cboDistrict)
In the query behind your subform, criteria the DistrictID with...
=Forms!frmMain!cboDistrictID
Set the Parent/Child relationship between the main and the subform as..
Parent = cboDistrict
Child = DistrictID
On the AfterUpdate evnt of cboDistict, Requery the subform to keep the
combo and subform in synch.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 

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