Combo Box in form linked to subform

P

ptlm65

I have a combo box that has from a query the fields: Name, HoursGiven
HoursRemaining.

The combo box backfills three text boxes: txtStudent, txtHoursGiven an
txtHoursRemaining with the code:

Private Sub cboStudent_AfterUpdate()
If IsNull(Me.cboStudent) Then
Exit Sub
End If
Me.txtName = Me.cboName.Column(0)
Me.txtHoursGiven = Me.cboName.Column(1)
Me.txtHoursRemaining = Me.cboName.Column(2)
End Sub

I have one table tblName with the fields: Name and HoursGiven
I have a seperate table tblHours with DateWorked and HoursWorked tha
is linked to the Name on the first table

How can I create a sub form listing DateWorked and HoursWorked and hav
the subform display only DateWorked and HoursWorked linked to the nam
chosen from the combo box in the main form
 
M

Marshall Barton

ptlm65 said:
I have a combo box that has from a query the fields: Name, HoursGiven,
HoursRemaining.

The combo box backfills three text boxes: txtStudent, txtHoursGiven and
txtHoursRemaining with the code:

Private Sub cboStudent_AfterUpdate()
If IsNull(Me.cboStudent) Then
Exit Sub
End If
Me.txtName = Me.cboName.Column(0)
Me.txtHoursGiven = Me.cboName.Column(1)
Me.txtHoursRemaining = Me.cboName.Column(2)
End Sub

I have one table tblName with the fields: Name and HoursGiven
I have a seperate table tblHours with DateWorked and HoursWorked that
is linked to the Name on the first table

How can I create a sub form listing DateWorked and HoursWorked and have
the subform display only DateWorked and HoursWorked linked to the name
chosen from the combo box in the main form?


It's not clear that you need a subform for this, but you can
set the subform control's Link Master property to the
txtName text box and the Link Child property to the
subform's name field.
 

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