J
JohnB
Hi.
I though this would be an easy one, so I'm surprised not to get any replies.
I though I'd give it one more try. Basically I want to modify existing code
that opens a form using SchoolID as the linking criteria. I want to add to
this linking criteria so that the form opened shows only those subform
records where field cboSubject contains "Maths". Thanks. JohnB
Original post:
Hi. Can anyone suggest a modification to the following code please? Its part
of the On Click event of a command button on a form that opens a second form,
frmPlacementsBySchool. This second form has a subform called
frmPlacementsSubform with a combo called cboSubject. (The control source of
cboSubject is a table and the choice of a particular subject puts SubjectID
in a field of the same name in tblPlacements). In addition to the existing
criteria (SchoolID) I want frmPlacementsBySchool to open and show only those
subform records that show "Maths" (which is SubjectID 7) in the combo. How
would I do that? I'm using Access 2002 on XP.
Thanks, JohnB
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmPlacementsBySchool"
stLinkCriteria = "[SchoolID]=" & Me![SchoolID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
I though this would be an easy one, so I'm surprised not to get any replies.
I though I'd give it one more try. Basically I want to modify existing code
that opens a form using SchoolID as the linking criteria. I want to add to
this linking criteria so that the form opened shows only those subform
records where field cboSubject contains "Maths". Thanks. JohnB
Original post:
Hi. Can anyone suggest a modification to the following code please? Its part
of the On Click event of a command button on a form that opens a second form,
frmPlacementsBySchool. This second form has a subform called
frmPlacementsSubform with a combo called cboSubject. (The control source of
cboSubject is a table and the choice of a particular subject puts SubjectID
in a field of the same name in tblPlacements). In addition to the existing
criteria (SchoolID) I want frmPlacementsBySchool to open and show only those
subform records that show "Maths" (which is SubjectID 7) in the combo. How
would I do that? I'm using Access 2002 on XP.
Thanks, JohnB
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmPlacementsBySchool"
stLinkCriteria = "[SchoolID]=" & Me![SchoolID]
DoCmd.OpenForm stDocName, , , stLinkCriteria