Parent Name?

  • Thread starter Thread starter AlCamp
  • Start date Start date
A

AlCamp

I have a subform that I use on 2 seperate forms. (frmStyles and
frmWarpDiary)

On the frmWarpDiary I need a bit more room, so I'd like to reduce the font
of the subform fields (and the width too), "on the fly", using the subform
OnOpen event. (I can handle the font/width code OK)

What's a good method for a subform to determine what Parent form it is
being used on?

I'd like to avoid the IsOpen function if possible, as it is possible that
the user could have both open at the same time.

Is the OnOpen event the best place to place my IF code?

Thanks in advance,
Al Camp
 
Paul,
Pretty sure I had tried that previously. The Name of the Parent form was
my first thought for a solution.

I tested this code seperately on the OnOpen, OnLoad, OnActivate events...

Dim ParentName as String '(also tried Variant)
ParentName = Me.Parent.Name ' < Placed a CodeBreak here
End If

ParentName came up as "Empty" every time. Also, Me.Parent.Name causes a
beep in the syntax checker (A97) on the second period.

Thanks Paul
Al Camp
 
Paul,
Pretty sure I had tried that previously. The Name of the Parent form was
my first thought for a solution.

I tested this code seperately on the OnOpen, OnLoad, OnActivate events...

Dim ParentName as String '(also tried Variant)
ParentName = Me.Parent.Name ' < Placed a CodeBreak here
End If

ParentName came up as "Empty" every time. Also, Me.Parent.Name causes a
beep in the syntax checker (A97) on the second period.
the subform is earlier then the parent

if you use an unbound subForm control on the mainForm and set the
sourceObject of the subformControl in the mainForm onOpen event., then
it will work
 
Andi,
Yes, I should have remembered that. The Main form isn't open when the
subform loads.
Your method works fine.
I actually have 4 "one line" subforms on this form, but I only had to
"unbind" one of them to fool the loading sequence.

Thanks for the help,
Al Camp
 
Back
Top