Van T. Dinh said:
You can call the (Main Form's) Current Event from the Subform's code if
you
declare the Form_Current Event of the main Form as Public rather than
Private.
....won't the VBA compiler object to changing that from private to public?
(sounds like a bad idea, COM interface-wise, anyway)
I think you can also use an ObjectVariable declared with "WithEvents" but
this is a bit more advanced.
That would be my approach.
....but even simpler:
In parent form Code:
public sub FireCurrent()
form_current
end sub
in subform code:
....
'using EARLY-binding...
Dim oFrm as [Form_<your_parent_form_name_here>]
set oFrm = Me.Parent
'note this will only work if you *know* that this form will only have *1*
"parent" form
oFrm.FireCurrent
set oFrm = nothing
'or...using LATE binding...
Dim oFrm as Object '(or also, possibly you could use: Form)
set oFrm = Me.Parent
'this will work if there might be multiple "parent" forms, but...
oFrm.FireCurrent
'if this public sub/function isn't present in the then-current "parent"
'form at run-time...*BOOM!*
'you could use an 'on error resume next' prior to the
' oFrm.FireCurrent ro avoid the error,
'but then it could fail silently...
'which could be ok, or just as bad, or even worse
'...depending on your App's needs.
set oFrm = nothing
- Mark