Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase ««12

reference recordsource on subform Expand / Collapse
Posted Thursday, April 10, 2014 6:51 AM


Group: General Forum Members
Last Login: Thursday, July 14, 2016 7:18 AM
Points: 108, Visits: 872
Thank you again
what calls the Public Property Get Ready()?
Is the process of setting
m_booReady = True
in the main form Open event
enough to call it?
Post #1560401
Posted Thursday, April 10, 2014 7:31 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Monday, June 13, 2016 1:06 AM
Points: 86, Visits: 1,088
m_booReady is what's usually called a member variable, meaning that:
1. It is declared outside any procedure in the module.
2. It is declared as Private.
The consequence is that such a variable is available from any procedure in the module where it is declared but cannot be accessed from outside this module.

The Ready property acts as an interface to provide the value of m_booReady to any procedure calling from outside the module of the parent form. It is called by the Form_Current event handler of SF1. Is the Ready property returns True, that means that the Form_Open event handler of the parent form has been executed, which cannot occur before all subforms (SF and SF2) are initialized.

That way, we know whether SF1.Form_Current can address the RecordSource property of SF2 or not. If Parent.Ready is False, that mean that SF2 probably is not loaded yet (or at least that the whole compound Parent + Subforms is not totally initialized). In such a case, we store the SQL string that must be used as the RecordSource for SF2 into another property of the parent: SQL.

When the Form_Open event handler of the parent will be processed, this SQL string (stored in the member variable m_strSQL in the parent form) will be sent to SF2. Without that precaution, SF2 would be left uninitialized (i.e. blank RecordSource) when the form is open and will only receive its RecordSource property when the next Form_Current event occurs for the parent form.

Have a nice day!
Post #1560423
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse