Ken Ismert
KIsmert at TexasSystems.com
Mon Nov 10 12:00:59 CST 2003
John: Two comments - 1. It escapes me why you would even want to manage an open, invisible form. If the user can't view it, then by far the simplist thing to do is not open it. Is there some other issue driving this need that you haven't elaborated on? 2. The object method of opening a form, Set FormObject = New Form_FormName, creates an invisible instance of your form. The user will be absolutely unaware of its presence until you decide to show it by setting Visible =True. That's the upside of this method. The downside is you can't use DoCmd.OpenForm. Instead, you would have to write your own object-oriented framework to manage the life of your forms. -Ken -----Original Message----- From: John Colby [mailto:jcolby at colbyconsulting.com] Sent: Saturday, November 08, 2003 11:45 AM To: Access Developers discussion and problem solving Subject: RE: [AccessD] A2K - setting a form invisible on open To expound a little, in my lightweight security I am trying to create functionality such that if a user can open a form but not view that form, then the form will open but immediately hide itself. To test this scenario, in the forms Activate event I check whether the user has permission to view the form. If not I immediately set the form.visible false. When opening the form, Activate fires, but setting the form's visible attribute false does not make the form invisible. If I manually hide the form, then use Window / unhide to unhide the form, Activate fires, the code sets visible false and the form immediately rehides itself (as I would expect to happen). If I manually use Window / Unhide a SECOND time, Activate NEVER FIRES so my code does not get a chance to hide the form again. You can test this for yourself by simply taking any form, creating an Activate event stub, and placing me.visible = false in it. The first time you do Windows / Unhide the event fires, the second time it doesn't! Furthermore, as you open the form the FIRST time, Activate fires, but setting me.visible = false does not hide the form! I do so love Access and all of it's "quirks/features/BUGS". John W. Colby www.colbyconsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of John Colby Sent: Saturday, November 08, 2003 11:11 AM To: AccessD Subject: [AccessD] A2K - setting a form invisible on open I have a form I want to open invisible every time it opens, regardless of how it is opened. I placed me.visible = false in OnOpen. That doesn't work! The strange part is that if I place a breakpoint on the line and stop execution on the me.visible = false, then continue, the form correctly hides itself. Has anyone ever seen such a strangeness? John W. Colby www.colbyconsulting.com _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com