[AccessD] A2K - setting a form invisible on open

John Colby jcolby at colbyconsulting.com
Mon Nov 10 13:17:01 CST 2003


Ken,

I am writing a security utility aimed at other developers.  It is designed
to allow YOU (and me as a developer) to manage the presentation security of
a database front end.  IOW, what forms can a user / group open?  View?  Add
records to?  Delete records in?  Edit records in?  Etc.

As you can see, I am not necessarily "in control of" the target FE at design
time since the FE is YOURS.  Why would you want to open a form not visible?
Perhaps the form is a filter form that you use to feed values to a query.
Perhaps the form has a timer ticking that performs some process.  Perhaps...
uh... I have no damned idea what else you might decide to do with a form
that is open but that a selected group or groups of users are not allowed to
see.  I know that I personally use a hidden form to force a cleanup of my
framework when the database closes.  Since a form cannot close without it's
OnClose firing, I use that to run a Terminate() function that closes
everything gracefully.  So not matter how the db closes, my term() function
runs.

I cannot allow the users to unhide that since it is a background processing
form and they have no business there.

In the end though, the answer is I don't know why any given developer is
going to want to open a form that users can't see, I simply know that it
happens and I need to provide the developer with a means of enforcing this
security.

BTW, thanks for #2.  I knew that but never used it.  I will use that in my
own framework for hiding my cleanup form.  It may be an answer to re-opening
the form that the developer wants hidden such that users can't see them.

This thread has been a good one for me.

Thanks again.

John W. Colby
www.colbyconsulting.com

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Ken Ismert
Sent: Monday, November 10, 2003 1:01 PM
To: 'Access Developers discussion and problem solving'
Subject: RE: [AccessD] A2K - setting a form invisible on open


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




_______________________________________________
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