Solved Syncronizing two related subforms

SuperSonicSam

New member
Local time
Tomorrow, 00:09
Joined
Jul 16, 2023
Messages
23
Hi there, can anyone help me troubleshoot the following problem? I am trying to link two subforms (housed in an unbound parent form) so that when I click on the continuous subform on the LHS, the records displayed in the the RHS subform match. Please see the first attachment. So far I haven't had success, even after searching on the web and using a 'txtMasterID' workaround. Also not sure if it's relevant (I am a beginner), but the tabs in the form on the RHS aren't connected to the rest of the form in the conventional way (see second attachement). More than happy to have any advise.
 

Attachments

There are several options. 3 variants that I usually use:
  • You can react in the main form to the current events of the subforms and then set the other one to the same record
  • You can use the same recordset in both forms
  • If you only navigate on the left side, you can bind the right subform to the primary key data field of the left side (easiest to do with a text field in the main form).

BTW: You can also insert images directly into the post, then you don't have to open a PDF file.
 
See my article which has several solutions to doing this:

 
Hi there, can anyone help me troubleshoot the following problem? I am trying to link two subforms (housed in an unbound parent form) so that when I click on the continuous subform on the LHS, the records displayed in the the RHS subform match. Please see the first attachment. So far I haven't had success, even after searching on the web and using a 'txtMasterID' workaround. Also not sure if it's relevant (I am a beginner), but the tabs in the form on the RHS aren't connected to the rest of the form in the conventional way (see second attachement). More than happy to have any advise.
Hi
Are you able to upload your actual database or a copy containing no confidential data?
 
Hi
Are you able to upload your actual database or a copy containing no confidential data?
Hi
Your relationships between tables is all wrong

You should be linking PrimaryKey to ForeignKey in related tables.

You have set up links as follows which show as Indeterminate when they should be One to Many.

The normal setup for your scenario is a Main Form based on StudentDetails with a
Subform containing a Tab Control with Pages for all related tables??

Why are you trying to link a Subform based on StudentDetails to another Subform based on the same StudentDetails??
 

Attachments

  • Indeterminate.jpg
    Indeterminate.jpg
    40.9 KB · Views: 96
FYI student with ID '2' has the most complete data shown throughout the subform tabs
 
Thanks mike60smart! You've solved the synchronisation problem, however, the tabbed part of the second subform section no longer functions.... I'm now convinced this has something to do with the unconventional way it was set up (i.e. with simple code in the 'on change event') in an effort to gain faster load times. Is it possible to get this tabbed part of subform working again using it's current configuration or does it need to be re-done using the conventional configuration?
 
Thanks mike60smart! You've solved the synchronisation problem, however, the tabbed part of the second subform section no longer functions.... I'm now convinced this has something to do with the unconventional way it was set up (i.e. with simple code in the 'on change event') in an effort to gain faster load times. Is it possible to get this tabbed part of subform working again using it's current configuration or does it need to be re-done using the conventional configuration?
Hi
Is this version better?
 

Attachments

Hi, the tabbed control in the second subform still no longer working (i.e. when clicking on the tabs, the subforms aren't displayed in the unbound SubformContainer which is immediately below the tab control.....see this area working correctly in the initial version posted of this database, before you corrected the synchronisation problem...thanks again for doing that). It may be the case that I just have to scrap the simple code in the 'on change' event (used to achieve faster load times) and re-do the tabbed subform using the usual method. Do you think that's the case?
 
Hi, the tabbed control in the second subform still no longer working (i.e. when clicking on the tabs, the subforms aren't displayed in the unbound SubformContainer which is immediately below the tab control.....see this area working correctly in the initial version posted of this database, before you corrected the synchronisation problem...thanks again for doing that). It may be the case that I just have to scrap the simple code in the 'on change' event (used to achieve faster load times) and re-do the tabbed subform using the usual method. Do you think that's the case?
Hi

You cannot just click a Tab Control and expect data to be displayed.

The process is you 1st select a Student in the Left Subform
Then all related data is displayed in the Tab Control Page you then select.
I attach the file again.
 

Attachments

You cannot just click a Tab Control and expect data to be displayed.
Mike,
The OP is setting the object source on each tab as it is selected, as opposed to loading all subforms on the load of the form.
 
@SuperSonicSam
If there is no data for a subform, it appears blank. So your subform appears not to work, but it actually does, it is the data that is at fault, (or your logic)?
DO NOT call a field ID without any other text. How is Access meant to know which is which. :(
In the spelling table you should have the FK as StudentIDFK or something along those lines to indicate

1. It is the StudentID
2. That is a Foreign Key to another table.
 
Mike,
The OP is setting the object source on each tab as it is selected, as opposed to loading all subforms on the load of the form.
Hi WGM

Yes and this is what happens in the example I uploaded.
There are no Subforms in the Second Subform just a TabControl with a number of Pages named "tabctlEval"
with an Unbound Control named "SubformContainer"

As long as the OP selects a specific Student in the 1st Subform then related data will display in the specific
Tab Control Page selected.

See Screenshot
 

Attachments

  • Screenshot.jpg
    Screenshot.jpg
    100.9 KB · Views: 94
Hi Mike & Gasman, FYI this is the video I followed to set up the tab control ( in case I'm not explaining it properly. When you click on each tabbed control I would like each respective subform to be displayed, even when there is no data in it. Would it be better to set up tab control the conventional way.....cause I'm thinking it'll solve problem (albeit result in longer load times).
 
@SuperSonicSam
If there is no data for a subform, it appears blank. So your subform appears not to work, but it actually does, it is the data that is at fault, (or your logic)?
DO NOT call a field ID without any other text. How is Access meant to know which is which. :(
In the spelling table you should have the FK as StudentIDFK or something along those lines to indicate

1. It is the StudentID
2. That is a Foreign Key to another table.
Thanks for this info Gasman
 

Users who are viewing this thread

Back
Top Bottom