how to link subforms to other subforms on an unbound form

pb21

Registered User.
Local time
Today, 04:16
Joined
Nov 2, 2004
Messages
122
I forum could someone tell me:

I have an unbound form on that form I want to put three sub forms one on a products table the other on a course start dates table and the link table that joins the other two together. all three are related to each other with Pk/FK links.

When I try to link them it says you cannot link items on an unbound form.

regards in advance
Peter:eek:
 
I was just having the same problem with 2 subforms and was able to solve it with code in the On Current Event of the 1st subform to which my 2nd subform refers. This code was copied from somewhere for another database I worked on.

Private Sub Form_Current()
Dim strParentDocName As String

On Error Resume Next
strParentDocName = Me.Parent.Name

If Err <> 0 Then
GoTo Form_Current_Exit
Else
On Error GoTo Form_Current_Err
Me.Parent![2ndSubformNameHere].Requery
End If

Form_Current_Exit:
Exit Sub

Form_Current_Err:
MsgBox Err.Description
Resume Form_Current_Exit

End Sub

Also your child and master links will need to be entered manually. On my 2nd subform they are as follows:

Link Child Fields:SampleRecordID
Link Master Fields: [1stSubformNameHere].Form![SampleRecordID]

Hope this helps!
 

Users who are viewing this thread

Back
Top Bottom