Stop subform opening on its own

P

Piers 2k

Hi folks,

Am trying to put a piece of code into a form load, so if it is not within
another form as a subform, it will display a message and cancel the event.
ie The user has double-clicked the form themselves.

Any idea how to test for this?

TIA,
Piers
 
W

Wayne Morgan

In the Open event of the form, check for the value Me.Parent.Name. If you
get error 2452, then there is no parent form, Cancel the open. If you get a
text string back, then you have a parent form.
 
Top