dmon000 . . .
Sorry to get back so late. Digging into this I realized it would be a bit more than I thought. So I put it on the back burner until I could give it its due focus.
I setup a simulation of what you have and received worse results than you state in your origination of this thread. Although the unbound textbox on Tab4 was finally updated, A [blue]racing condition occurs[/blue], as if all the records on tab3 were parsed, then tab4. I've flagged this for [blue]research[/blue] as its completely unacceptable, and I've never run into this before.
The biggest problem (using proper syntax) is opening of the mainform:
TheAceMan1 said:
[blue]Be Aware: When you open a mainform with subforms, the mainform opens from the innermost subform level out to the mainform which opens last.[/blue]
This means your subforms open in some unknown order first (usually in the order you inserted the subforms), then the mainform. The problem here is that [blue]code you need to reference the subform on Tab4 via the subform on Tab3,
requires referencing the mainform, [purple]
which is not yet open![/purple][/blue] . . . [blue]Can you see it![/blue]
So to fix this, [blue]were going to flag wether the mainform is open or not[/blue], as an indication of what to do in our code in the tab3 subform. Where going to let the mainform do the updating On Open (no way out), and let the tab3 subform thru its [blue]On Current[/blue] event and the [blue]AfterUpdate[/blue] event of the edited field, perform the updates of the tab4 unbound textbox there after.
Be aware: in the above paragraph, I'm assuming in my use of the tab3 [blue]On Current[/blue] event, you do desire the update to reflect the current tab3 record as well! . . . as you navigate record to record!
So lets do this:
[ol][li]Save tab3 subform under a new name so you can come back to square one if necessary.[/li]
[li]Delete any code involved in updating the tab4 unbound textbox. Be sure of this, as [blue]we don't need any extraneous code screwing things up![/blue][/li]
[li]In the [blue]declaration section[/blue] of a module in the modules window, copy/paste the following public variable:
Code:
[blue]Public MainFormIsOpen As Boolean[/blue]
[/li]
[li]In the [blue]On Load[/blue] event of the mainform, copy/paste the following:
Code:
[blue] Dim ctlSrc As Control, ctlDes As Control
Set ctlSrc = [[purple][B][I]tAB3subFormName[/I][/B][/purple]].Form![[purple][b][B][I]TextboxName[/I][/B][/purple]]
Set ctlDes = [[purple][B][I]tAB4subFormName[/I][/B][/purple]].Form![[purple][B][I]UnboundTextboxName[/I][/B][/purple]]
MainFormIsOpen = True
ctlDes = ctlSrc
Set ctlSrc = Nothing
Set ctlDes = Nothing[/blue]
[/li]
[li]In the mainforms [blue]On Close[/blue] event, copy/paste the following:
Code:
[blue] MainFormIsOpen = False[/blue]
[/li]
[li]Finally, in the tab3 subforms [blue]On Current [/blue] event & the Tab3textbox [blue]AfterUpdate[/blue] event, copy/paste the following:
Code:
[blue] If MainFormIsOpen Then
Me.Parent![[purple][B][I]tAB4subFormName[/I][/B][/purple]].Form![[purple][B][I]UnboundTextboxName[/I][/B][/purple]] = Me![[purple][b][B][I]Tab3TextboxName[/I][/B][/purple]] End If[/blue]
[/li][/ol]
[blue]Your Thoughts? . . .[/blue]
See Ya! . . . . . .
Be sure to see thread181-473997
Also faq181-2886