|
-
Jun 21st, 2008, 11:23 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] Source Event from Access Subform
OK, I have never posted one of these before, but here goes.
I am using access/VBA to build the front end of a database application. I am 99% self-taught with coding and OOP, so please bear with me.
My model is based on a treeview control providing a string reference to a form name, which then tells a parent form which (of many) subforms to "load" into the "subform" control:
strSfmName = TvNode.Text
Me.chdSfm.SourceObject = strSfmName
Currently, once the Sfm is loaded, the parent then sets an object reference to it:
Set Sfm = Me.chd.Form
Now the Parent form "knows" about the Sfm and can control it.
The bad juju is that, right now the Sfm ALSO needs to set a reference to the parent, in order that it can "tell" the parent when it is done with whatever it is doing, and pass info back. THis ACTUALLY occurs as a call from the parent as follows:
(Call from the parent form):
Call Sfm.SetParentRef(Me)
(Procedure on child):
Private frmParent As Form 'Declare a form object
Public Sub SetParentRef(ByVal frm As Form)
If not frm = Nothing Then
Set frmParent = frm
End If
I understand that this may potentially result in a circular reference/memory leakage problem (and is just bad programming practice!).
I would prefer that the PARENT always know "who" the child is, but that the child need not know who the parent is, and instead raise an eevent to tell the parent it is "done" and to come "get the mail" (Access properties to retrieve information".
Accesss does not seem to provide a way for me to source custom events from the loaded Sfm instance which can be "heard" by the parent.
Any ideas? (and did what I just described make sense? i am VERY new at this . . .)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|