Keeping Forms/multiple subforms in synch

K

Kevin Witty

If you want to, as I often do, change the recordsource of a subform of the
form which you're changing data in to match the contents of the field you're
changing, "BeforeUpdate" on the field in the main form you're changing is
the trick (Me.SubFormName.Form.RecordSource = "select * from {QueryName}
where {SomeCriteria, including the field you're changing, but haven't exited
yet}.

And if you are navigating through the records in the subform ("subformA"),
and want to change the contents of another subform ("subformB") of your
mainform depending on which subformA record you're on, then an OnClick event
on the field in subformA you want to select subformB records on which says:

Me.Parent.Form!subformB.Form.RecordSource = tSQL

where tSQL is "select * from {subformB's underlying query} where {criteria
based on the fields in subformA};"

will present those records appropriately. (Oddly enough, the OnCurrent
event barfs on this code.)

I can't tell you how much time knowing the above code would have saved me
over the years. Hope it helps someone. (And that the Wiz doesn't tell me
I'm full of noodles!)

Kevin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top