ComboBox in Main Form Problem

  • Thread starter Thread starter JKK
  • Start date Start date
J

JKK

I have a main form with 1 combo boxes StudentID

Student ID comer from tbl_Roster and the subform displays the records from
tbl_Objectives that match StudentID.

I now want to add a 2nd combo to the main form - year form tbl_Year.
I would like the subform to display all the records that match the criteria
that match both combo boxes.
How do I get the subform to display the records that meets both criteria
now.

Thanks in advance.

Joe
 
1. Open the main form in design view.

2. Right-click the edge of the subform control, and choose Properties.

3. On the Data tab of the Properties box, set and the name of the 2nd combo
to the LinkMasterFields property, and the name of the matching field in the
subform to the LinkChildFields property.

The properties will end up looking something like this:
[StudentID]; [TheYearField]
[Combo1]; [Combo2]
 
Thanks- worked like a charm.

Now I have to figure out how to print the report using the same criteria. My
strLinkCriteria statement relect both criteria, but all goals are showing up
so far..

stLinkCriteria = "tb_Roster![StudentID]=" & "'" & Me![StudentID] & "'" & "
AND " & "tb_Year![Year]=" & "'" & Me![GoalYear] & "'"

Once again thanks. All is appreciated for what you do for this group.

Joe



Allen Browne said:
1. Open the main form in design view.

2. Right-click the edge of the subform control, and choose Properties.

3. On the Data tab of the Properties box, set and the name of the 2nd
combo to the LinkMasterFields property, and the name of the matching field
in the subform to the LinkChildFields property.

The properties will end up looking something like this:
[StudentID]; [TheYearField]
[Combo1]; [Combo2]

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

JKK said:
I have a main form with 1 combo boxes StudentID

Student ID comer from tbl_Roster and the subform displays the records
from tbl_Objectives that match StudentID.

I now want to add a 2nd combo to the main form - year form tbl_Year.
I would like the subform to display all the records that match the
criteria that match both combo boxes.
How do I get the subform to display the records that meets both criteria
now.
 
If StudentID and GoalYear are Number type fields (not Text type fields),
drop the extra quotes:

stLinkCriteria = "(tb_Roster![StudentID] = " & Me.StudentID & _
") AND (tb_Year![Year] = " & Me.GoalYear & ")"

You may also be able to drop the table names.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

JKK said:
Thanks- worked like a charm.

Now I have to figure out how to print the report using the same criteria.
My strLinkCriteria statement relect both criteria, but all goals are
showing up so far..

stLinkCriteria = "tb_Roster![StudentID]=" & "'" & Me![StudentID] & "'" & "
AND " & "tb_Year![Year]=" & "'" & Me![GoalYear] & "'"

Once again thanks. All is appreciated for what you do for this group.

Joe



Allen Browne said:
1. Open the main form in design view.

2. Right-click the edge of the subform control, and choose Properties.

3. On the Data tab of the Properties box, set and the name of the 2nd
combo to the LinkMasterFields property, and the name of the matching
field in the subform to the LinkChildFields property.

The properties will end up looking something like this:
[StudentID]; [TheYearField]
[Combo1]; [Combo2]

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

JKK said:
I have a main form with 1 combo boxes StudentID

Student ID comer from tbl_Roster and the subform displays the records
from tbl_Objectives that match StudentID.

I now want to add a 2nd combo to the main form - year form tbl_Year.
I would like the subform to display all the records that match the
criteria that match both combo boxes.
How do I get the subform to display the records that meets both criteria
now.
 
Back
Top