Updating a parent form from a subform
Subforms do not know about their parent form and there is no way to pass a reference of the parent form to a subform to "link" the two. Instead we have to go an unconventional route which is described in this recipe.
How to do it...
Create a new form using the Object Designer.
Add the following global variables:
Name
Type
Subtype
A
Integer
B
Integer
XMLDoc
Automation
'Microsoft XML, v6.0'.DOMDocument60
Add a global function named
SendMessage
with the following code:XMLDoc.loadXML('<root></root>');
Add a global function named
GetA
that returns an integer with the following code:EXIT(A);
Add a global function named
GetB
that returns an integer with the following code:EXIT(B);
Add a global function named
SetXMLDoc
that takes in the following parameter:Name
Type
Subtype
XMLDocParam
Automation
'Microsoft XML, v6.0'.DOMDocument60
Add the following code to the function:
XMLDoc := XMLDocParam;
Add two textboxes to the form.
Set the
SourceExpr...