Help to link subform to subform (1 Viewer)

lookforsmt

Registered User.
Local time
Tomorrow, 01:32
Joined
Dec 26, 2011
Messages
576
HI! all

i have one main form with two subforms within it.
i have managed to link 2nd subform to Main form by Link Master Fields & Link Child Fields. However i am struggling to link 2nd subform to 3rd subform
Any suggestions.

Below are the 3 forms in my db

Code:
MainForm          frmVisit
PK                VisitId
=========================================
1st SubForm      subfrmTasks
PK                TaskId
Number            VisitId
=========================================
2nd SubForm     subfrmComments
PK              CommentsId
Number          TaskId
Thanks
 

arnelgp

error reading drive A:
Local time
Tomorrow, 05:32
Joined
May 7, 2009
Messages
9,336
add unbound Textbox (txtLink) to main form.
make its Visible property to No.
add code to subform2 Current Event:
Code:
private sub form_current()
on error resume next
Me.Parent!txtLink = Nz(Me.CommentsID, 0)
end sub
now add Link Master Fields & Link Child Fields to subform3:

Link Master Fields: [txtLink]
Link Child Fields: [CommentsID]
 

lookforsmt

Registered User.
Local time
Tomorrow, 01:32
Joined
Dec 26, 2011
Messages
576
HI! Arnelgp, i have followed upto the code.

not able to do the below linking

Code:
now add Link Master Fields & Link Child Fields to subform3:

Link Master Fields: [txtLink]
Link Child Fields: [CommentsID]
i have attached my db, if its the same understanding what you gave me the code.
Thanks
 

Attachments

Last edited:

arnelgp

error reading drive A:
Local time
Tomorrow, 05:32
Joined
May 7, 2009
Messages
9,336
do you mean link subfrmComments to subfrmTasks:

on subfrmtask current event:
Code:
Private Sub Form_Current()
On Error Resume Next
Me.Parent!txtLink = Nz(Me.TaskId, 0)
End Sub
now on subfrmComments:

Link Master Fields: txtLink
Link Child Fields: [TaskID]
 

lookforsmt

Registered User.
Local time
Tomorrow, 01:32
Joined
Dec 26, 2011
Messages
576
HI! tried as you have mentioned and yes i want to link SubformComments to SubformTask

after i update Task and move to update Comments and come out of the form. It does not get linked.
 

lookforsmt

Registered User.
Local time
Tomorrow, 01:32
Joined
Dec 26, 2011
Messages
576
HI! Arnelgp, Apologies for the confusion. Made wrong updates. I will re try and post the results.
 

lookforsmt

Registered User.
Local time
Tomorrow, 01:32
Joined
Dec 26, 2011
Messages
576
HI! Arnlegp, i have done the updates but on subfrmTask, field TaskId does not get updated in subfrmComments field TaskId.

Hope i have clarified my question.
 

lookforsmt

Registered User.
Local time
Tomorrow, 01:32
Joined
Dec 26, 2011
Messages
576
HI! Arnelgp, again apologies for the confusion. I think i have got what i wanted.
Thank you for prompt support whenever required.

God bless you
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom