auto populate subform?

cuttsy

The Great Pretender
Local time
Today, 16:46
Joined
Jun 9, 2004
Messages
164
I have a form frmSchools based on tblSchools containing an ID and address details. I then have a subform called frmContacts based on tblContacts with an ID 1st & 2nd names and schoolWorked. This has a subform frmJobs based on table tblContactsToJobs which shows any duties they are assigned i.e. 'head of maths'.

The forms work fine in that when school A is shown in the main form the records of the contacts who work there are in the subform and the jobs of the contacts are shown in the sub-subform.

However I need data input to be very VERY easy. I set up a listbox in the main form whose content changes for whichever record is selected. If school A is selected only contacts working there are shown in the listbox. I have done this using this code.

Dim sContactSource As String
sContactSource = "SELECT [tblContacts].[personID], [tblContacts].[sName], [tblContacts].[fName], [tblContacts].[school] " & _
"FROM tblContacts " & _
"WHERE [school] = " & Me.school_ID.Value
Me.cList.RowSource = sContactSource
Me.cList.Requery


This works great. However I want to use the listbox to auto populate the subform. I can auto populate the form the listbox is in but i need it to do it for the subform.

Im desperate for this to work and i've been on this for about a day and a half and am getting nowhere. Thanks!
 

Users who are viewing this thread

Back
Top Bottom