referencing subform Control from within a second synchronised subfrom

coasterman

Registered User.
Local time
Today, 07:16
Joined
Oct 1, 2012
Messages
59
[SOLVED]:referencing subform Control from within a second synchronised subfrom

I have a main form frmAddressEdit and two linked subforms (listed below) on that main form. The two subforms are synchronized by an unbound text box on the main form.

sfrmIssueHeader is a continuous form and simply populates fields with a time stamp and the NetworkUsername when the user enters a value in the IssueSummarytxt field
sfrmIssueDetails is a single view form which as I say is synchronised to whatever record the user has selected in the sfrmIssueHeader form

the subform controls names and their subforms are identically named. The subforms obviously share the same record source.

What I am trying to do is have the subform control for sfrmIssueDetails .visible = false when the record in the sfrmIssueHeader is empty thereby preventing the user jumping straight into the subfrmIssueDetails form without making an entry in IssueSummarytxt on the sfrmIssueHeader form.

I've tried what I thought was the correct syntax from this link http://access.mvps.org/access/forms/frm0031.htm but cant seem to hit on the right combination.

My thought was I must be in Sub1 therefore the linked subform control is simply a control to reference on main form in which case Me.Parent!Controlname.visible = False would be correct, clearly it isn't

I assume the code needs to go on the Form_Current event of sfrmIssueDetails?

I had also tried to use the unbound text box mentioned on the Main form to trigger the event in the sfrmIssueDetails control but either I again I must be getting the syntax wrong.

Any help here would be gratefully received.
 
Last edited:
When is the record in the sfrmIssueHeader "empty"? Under what conditions?
 
After some more experimenting and using the Expression builder just to get the syntax I seem to have got it sorted

Code:
If Nz(Forms![AddressEdit]![sfrmIssueAddressHeader].Form![IssueSummary], "") = "" Then
        Forms![AddressEdit]![sfrmIssueAddressDetails].Visible = False
    Else
        Forms![AddressEdit]![sfrmIssueAddressDetails].Visible = True
End If

I put this in the Form_Current of sfrmIssueAddressDetails and also in the AfterUpate event of the IssueSummarytxt in sfrmIssueAddressHeader

Thanks to all those who looked in but unusually it must be said I managed to work this one out myself:D
 
Thanks! That's when you learn the most from the experience!
 

Users who are viewing this thread

Back
Top Bottom