[AccessD] How do I tell if a form is opened as a subform or not?

Gustav Brock gustav at cactus.dk
Fri Mar 14 12:23:30 CST 2003


Hi Drew

> Can't follow that.  What do you mean?  If I open the form, it's opened as a
> main form.  If I open a form with the MC as a subform, it is opened as a
> subform.  My routine that checks for whether it is a subform or not is used
> is more places that just the onload event.
> The code you had posted would work on the onload event of all forms, ..

yes

> .. with the exception of that one instance I mentioned, where you
> are 'assigning' the subform at a later point (after that form was
> used as a Main form).  I don't have any projects that do that.

That is what I meant. I have neither done such projects and have never seen
any - but it is, of course, possible though very unlikely.

> However, I do check for whether or not my form is a subform for
> certain processes, at which point if the MC form was opened afterwards, it
> would fail that check.

It doesn't fail here:

Private Sub Form_Open(Cancel As Integer)

  MsgBox Str(IsSubform())

End Sub

You have a main form with your MC as a subform. You then open form MC
as a main form and then the check fails? Strange.

/gustav


> I see. But don't you open a new instance of the calendar if it is
> open as a main form and you open another main form with the calender
> as a subform? 

>> Actually, the code I posted was from my new MiniCalendar, which could be
>> used as a subform, or as a stand alone, or both at the same time.




More information about the AccessD mailing list