[AccessD] Prevent displaying a form until...

Stuart McLachlan stuart at lexacorp.com.pg
Thu Aug 26 15:31:02 CDT 2010


Open all forms "hidden" with

docmd.OpenForm myform,,,,,acHidden

In the form's on_open

if userOK then
  me.visible = true
else
  msgbox "You can't view this form"
  cancel = true
end if

-- 
Stuart


On 26 Aug 2010 at 16:00, jwcolby wrote:

> I am starting to test my table driven Presentation Level Security
> system.  I have a login etc.  When a form opens, in the OnOpen I
> initialize an instance of the class that will drive the security for
> that form.  I do it there because I can set Cancel = true to force the
> form to shut back down if the user is not allowed to use the form.
> 
> The problem is that the form *displays* even if it eventually shuts
> back down.
> 
> This is an issue because I pop up a message box saying that the user
> is not allowed to open the form, but it is already open and displaying
> data behind the message box.  Oooops.
> 
> The only other time I have addressed this issue I opened a dummy form
> in front of the form being opened so that the form actually being
> opened was hidden.  That is an ugly solution to a common problem.
> 
> Has anyone solved this problem in an elegant fashion.
> 
> -- 
> John W. Colby
> www.ColbyConsulting.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