[AccessD] A2K - setting a form invisible on open

John Colby jcolby at colbyconsulting.com
Sat Nov 8 12:24:55 CST 2003


More stuff.  I just discovered that as you try to unhide the form the first
time, it rehides but APPARENTLY the focus stays on that form.  I say that
because the database window (the only other thing visible/open in my testing
case) does NOT have the focus, and the design toolbar "disables", i.e. all
the controls gray out.  If you click on the database window it gets the
focus, the toolbar "enables" and THEN if you try to unhide the hidden form a
second time, it correctly does NOT unhide!!!

There's a hint in there somewhere I have to believe.

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 12:45 PM
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



_______________________________________________
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