Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 10-13-2019, 09:24 AM   #1
lookforsmt
Newly Registered User
 
Join Date: Dec 2011
Posts: 523
Thanks: 74
Thanked 2 Times in 2 Posts
lookforsmt is on a distinguished road
Help to link subform to subform

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

lookforsmt is offline   Reply With Quote
Old 10-13-2019, 09:32 AM   #2
arnelgp
error reading drive A:
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 8,568
Thanks: 68
Thanked 2,744 Times in 2,629 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Help to link subform to subform

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]
__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
Old 10-13-2019, 09:32 AM   #3
bob fitz
AWF VIP
 
Join Date: May 2011
Location: Essex England
Posts: 3,530
Thanks: 52
Thanked 683 Times in 665 Posts
bob fitz has a spectacular aura about bob fitz has a spectacular aura about bob fitz has a spectacular aura about
Re: Help to link subform to subform

I think he following link answers your problem:
http://www.fmsinc.com/MicrosoftAcces...edSubforms.asp

__________________
Bob Fitzpatrick
Microsoft Community Contributor Award (2011)
If this helped, please click the scales at the bottom left of this posting.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Many thanks.


I have never failed. I have found a thousand ways that do not work!
bob fitz is offline   Reply With Quote
Old 10-13-2019, 09:59 AM   #4
lookforsmt
Newly Registered User
 
Join Date: Dec 2011
Posts: 523
Thanks: 74
Thanked 2 Times in 2 Posts
lookforsmt is on a distinguished road
Re: Help to link subform to subform

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
Attached Files
File Type: accdb Tracker_v1.2.accdb (740.0 KB, 5 views)

Last edited by lookforsmt; 10-14-2019 at 06:40 PM.
lookforsmt is offline   Reply With Quote
Old 10-13-2019, 10:13 AM   #5
arnelgp
error reading drive A:
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 8,568
Thanks: 68
Thanked 2,744 Times in 2,629 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Help to link subform to subform

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]
__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
Old 10-13-2019, 10:21 AM   #6
lookforsmt
Newly Registered User
 
Join Date: Dec 2011
Posts: 523
Thanks: 74
Thanked 2 Times in 2 Posts
lookforsmt is on a distinguished road
Re: Help to link subform to subform

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 is offline   Reply With Quote
Old 10-13-2019, 10:23 AM   #7
lookforsmt
Newly Registered User
 
Join Date: Dec 2011
Posts: 523
Thanks: 74
Thanked 2 Times in 2 Posts
lookforsmt is on a distinguished road
Re: Help to link subform to subform

HI! Arnelgp, Apologies for the confusion. Made wrong updates. I will re try and post the results.

lookforsmt is offline   Reply With Quote
Old 10-13-2019, 10:39 AM   #8
lookforsmt
Newly Registered User
 
Join Date: Dec 2011
Posts: 523
Thanks: 74
Thanked 2 Times in 2 Posts
lookforsmt is on a distinguished road
Re: Help to link subform to subform

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 is offline   Reply With Quote
Old 10-13-2019, 10:45 AM   #9
lookforsmt
Newly Registered User
 
Join Date: Dec 2011
Posts: 523
Thanks: 74
Thanked 2 Times in 2 Posts
lookforsmt is on a distinguished road
Re: Help to link subform to subform

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
lookforsmt is offline   Reply With Quote
Old 10-13-2019, 11:14 AM   #10
arnelgp
error reading drive A:
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 8,568
Thanks: 68
Thanked 2,744 Times in 2,629 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Help to link subform to subform

youre welcome!

__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
link Child/Master fields from a subform within a subform DiscombobulatedDuck7 Modules & VBA 4 08-23-2018 03:45 PM
[SOLVED] Form Subform of Subform Link diofree Forms 7 12-11-2015 11:02 AM
Link a subform to a subform in a Tab control dpalai Forms 9 08-16-2012 01:31 PM
How to link a subform to another subform? Thanks! littlejay Forms 3 03-06-2010 01:01 PM
Subform Link jax Forms 1 05-17-2006 01:28 AM




All times are GMT -8. The time now is 03:27 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World