syncronize two subforms

Djblois

Registered User.
Local time
Today, 10:16
Joined
Jan 26, 2009
Messages
598
I found some code to syncronize two forms and thought it would work for two subforms as well but it will not work. Here is the code:

Code:
Form_frmOrders.Filter = "Appt_ID = forms!subfrmAppts!tbapptID"
    Form_frmOrders.FilterOn = True

How do I change this so the frmOrders (which is one subform) only shows the orders for subfrmAppts (this is the other subform).
 


that website states this about two subforms on a bound form:
A Subform Cannot Link to Fields in a Subform of its Parent

In a regular main to subform design, the Link Master Fields property would be based on a control on the main form. In the two subforms scenario, the second subform is filtered on a value in the first subform. Unfortunately, the subform's Link Master Fields property cannot directly reference a field in the first subform. It can only reference a field in its parent form.
which is rubbish - i've linked two subforms to each other directly - while the work-around on that site should work it's an unnecessary step - you just need to make sure to get your subform syntax correct:



on the subform B control from which i want to display more details from subform A, i have this in the links:



LinkMasterFields (this field is on subform A)

Code:
Forms!frmRLBsetup!frmRLBsetup_samples.Form!RLBrunID
LinkChildFields (this field is on subform B)
Code:
RLBrunID
view the attachment: it is a snapshot of how this works. on the left are samples (subform A) i run through an experiment. each sample can have more than one hit for a positive result - which is displayed in the top-right hand subform (subform B)

when i want to input results for each individual sample run, i click on the sample i want to enter/view data on, it brings up the appropriate record for that sample in the subform.

the parent form is bound to each experiment run.
 

Attachments

  • SyncSubforms.jpg
    SyncSubforms.jpg
    81.4 KB · Views: 127
Most cool, wiklendt!

I do wonder why they made that claim; knowing Luke & FMS Inc., they're quite thorough, so it makes me wonder if they just slipped this time or they found a problem.

Anyway, I'm all for simplicity; generally don't like to use hidden textboxes and the likes. :)
 
well, the other possibility is that i'm in the wrong, and while my solution works, it may cause grief in the future - though i've not come across any grief yet, and i don't see any ill effects in data integrity etc...
 
FWIW, me either. As I indicated earlier, I'd rather reference things directly than indirectly as it seems to me more robust way of doing things. If I had a need for such setup, I would probably have done it your way, in fact.
 
thanks for the reassurance banana, i trust your methods so i'm happy and feel like i'm on the right track with that :)
 
A potentially easier way (and to avoid syntax errors) might be to click on the "..." button beside the Control Source box on the properties of the item you want to update, and then "build" the event by navigating to the form you want to pull the info from, and the field.

Might be of use :)

Ruth
 

Users who are viewing this thread

Back
Top Bottom