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

Drew Wutka DWUTKA at marlow.com
Fri Mar 14 11:55:01 CST 2003


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, 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.  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.

Drew

-----Original Message-----
From: Gustav Brock [mailto:gustav at cactus.dk]
Sent: Friday, March 14, 2003 5:28 AM
To: Drew Wutka
Subject: Re: [AccessD] How do I tell if a form is opened as a subform or
not?


Hi Drew

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? 

/gustav


> 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.

> Drew

> -----Original Message-----
> From: Gustav Brock [mailto:gustav at cactus.dk]
> Sent: Thursday, March 13, 2003 3:41 AM
> To: Drew Wutka
> Subject: Re: [AccessD] How do I tell if a form is opened as a subform or
> not?

>> I know what you are saying about intentionally looking for an error.  It
>> gives me an uneasy feeling too, but there are some things that just
>> absolutely require it.

> Of course, and no problem with that.
> However, I can't imagine why one would do as described in your
> example - I've never designed a form to be used as both a main form
> and a subform and indeed not at the same time - but, well, never say
> never.

> /gustav

>> As far as your code, I'm pretty tired so I could be wrong on this, but I
>> think I could trigger a false positive with your code.  If you opened
>> formA,
>> then opened formB, then set the source object on a subform on FormA to
>> FormB, you will now have FormB as a subform on FormA, but your function
>> will
>> say False, because FormB was the last form to be put into the form's
>> collection AND it is also now a subform.  (Actually, just tried it, and
it
>> did say false from the subform)

>> I know, it wouldn't be a common occurrence, but the error method is
>> guaranteed to be correct.

_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list