Full Version: Linking two subforms
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
GISTech
I don't know if it is possible to do what I am trying to do, but if it is I'll be really happy ---

I have one form - say PersonInfo - on this form, linked to TablePersonInfo. I have two subforms that are linked to the same table - TablePersonFILE. The first subform (A) is in table view (datasheet view) - the second subform (B) is in form view. Both of these subforms contain the same info of course as they are from the same table. What I am looking to do is use the subform A as a list of what "Files" the person on the main form "PersonInfo", as each peron can have many "Files" associated to. The second subform B is used to actually display, edit and add "File" information. (Subform A has been locked so can't make changed to the data).

My question/need --- I want to be able to click on a line/record in subform A and have the subform B jump to this record. Similary whatever record is showing on subform B have highlighted/selected in the top form/datasheet view.

AND when someone enters a new record in subform B - subform A needs to be refreshed to show this new field (I think I can figure this out, but am stuck on the first issue)

If anyone has any ideas - it would be greatly appreciated. I've tried creating different subs extra on click or mouse down - but it always has the value of the last record selected - not the new one that was just clicked.

Thanks a lot -
niesz
Welcome to UA Forums!

It seems as if what you're wanting to do is possible. You'll probably need to make use of "Me.Parent" and "Requery", as well as other methods in code.

But for specific information, posting the DB is best. (Zipped and under 500KB)
GISTech
Thanks for the reply. Unfortunatly I can't post my DB, as it has securtiy information within.
niesz
You may want to consider removing all confidential info and posting a sample DB.
GISTech
Unfortunatly my lables and everything are sensitive.
GISTech
Anyone else out there have any ideas on where I should start....
Thanks
Jack Cowley
The thought that comes to mind is to have an unbound control on the main form and set the MasterLink of subformB to this control. Then add code to subformA to have the selected record populate that unbound control. That will cause subformB to show the related record from SubformA.

In the On Current event of SubformA

Me.Parent.NameOfUnboundControl = Me.NameOfControlWithPrimaryKey

I hope I correctly understood what it is you want to do...

Jack
GISTech
I'll give it a try tomorrow morning and let you know how it goes.
thanks
Jack Cowley
You are welcome... It should work as I have done it a number of times... Good luck!

Jack
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.