linking two subforms and a main form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have three subforms on my main form (which contains Name, ID information)
and I want to link two of the subforms together by semester (which is 3
digits long). So, what I need is for the semester in one subform to update
into the second subform so that I can enter placement choices for different
semesters for each student. I've tried a bunch of things so far but haven't
been successful! Can anyone help me?!?

Thanks!
 
I linked two subforms in the following way:

1. Create a textbox on the mainform (e.g. txtSemesterID) and make it
invisible.

2. Use this as the Master field and link the second subform to it via the
"Link Master fields" and "Link Child fields" properties of the second
subform.

3. Add code to the "On Current" event of the first subform. This code
will update txtSemesterID on the main form to the SemesterID field in the
first form. It will also requery the second subform.

You code in the first subform might look like this...

Private Sub Form_Current()
Me.Parent.txtSemesterID = Me.SemesterID
Me.Parent.frmSecondForm.Form.Requery
End Sub

Don't forget the error trapping, particularly for null values.

Scott
 
Back
Top