Help to link subform to subform (1 Viewer)

lookforsmt

Registered User.
Local time
Tomorrow, 00:41
Joined
Dec 26, 2011
Messages
672
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

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 04:41
Joined
May 7, 2009
Messages
19,169
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, 00:41
Joined
Dec 26, 2011
Messages
672
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

  • Tracker_v1.2.accdb
    740 KB · Views: 110
Last edited:

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 04:41
Joined
May 7, 2009
Messages
19,169
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, 00:41
Joined
Dec 26, 2011
Messages
672
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, 00:41
Joined
Dec 26, 2011
Messages
672
HI! Arnelgp, Apologies for the confusion. Made wrong updates. I will re try and post the results.
 

lookforsmt

Registered User.
Local time
Tomorrow, 00:41
Joined
Dec 26, 2011
Messages
672
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, 00:41
Joined
Dec 26, 2011
Messages
672
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
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 04:41
Joined
May 7, 2009
Messages
19,169
youre welcome!
 

Users who are viewing this thread

Top Bottom