This should be an easy one, but I can't figure it out.
frmProvider (data source: tblProvider) displays information about child care providers. Since tblProvider is fairly large, I am using a tabbed control to display all the fields on frmProvider.
In addition to the tabs which contain the provider information, I have another tab that displays a sub-form (sfrmProviderCh ildren) of the children registered to this provider. This sub-form gets it's data from a query that pulls data from tblChild and tblRegistration (a bridge table to tie tblProvider to tblChildren together in a many-to-many relationship). Then, the subform is tied to it's parent from with provider_id (child field) and id (master field).
A second form in the database, called frmChild, displays information on the children from tblChild.
I have a control (cmdAddKids) on frmProvider that is supposed to open frmChild with a subset of records that contains only the children registered to the current provider.
Here are the structures for the tables involved:
Here is my code, but it opens frmChild with all kids instead of just the ones registered to to the current provider:
Help??
frmProvider (data source: tblProvider) displays information about child care providers. Since tblProvider is fairly large, I am using a tabbed control to display all the fields on frmProvider.
In addition to the tabs which contain the provider information, I have another tab that displays a sub-form (sfrmProviderCh ildren) of the children registered to this provider. This sub-form gets it's data from a query that pulls data from tblChild and tblRegistration (a bridge table to tie tblProvider to tblChildren together in a many-to-many relationship). Then, the subform is tied to it's parent from with provider_id (child field) and id (master field).
A second form in the database, called frmChild, displays information on the children from tblChild.
I have a control (cmdAddKids) on frmProvider that is supposed to open frmChild with a subset of records that contains only the children registered to the current provider.
Here are the structures for the tables involved:
tblProvider
tblprovider.id (PK)
tblprovider.lna me
tblprovider.fna me
tblChild
tblchild.id (PK)
tblchild.lname
tblchild.fname
tblRegistration
tblRegistration .provider_id (PK)
tblRegistration .child_id (PK)
tblprovider.id (PK)
tblprovider.lna me
tblprovider.fna me
tblChild
tblchild.id (PK)
tblchild.lname
tblchild.fname
tblRegistration
tblRegistration .provider_id (PK)
tblRegistration .child_id (PK)
Here is my code, but it opens frmChild with all kids instead of just the ones registered to to the current provider:
Code:
Private Sub cmdAddKids_Click()
On Error GoTo Err_cmdAddKids_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmChild"
stLinkCriteria = "[tblAssignment].[provider_id]=" & Me![id]
DoCmd.OpenForm stDocName, , , , acFormEdit
Exit_cmdAddKids_Click:
Exit Sub
Err_cmdAddKids_Click:
MsgBox Err.Description
Resume Exit_cmdAddKids_Click
End Sub
Comment