Stuart McLachlan
stuart at lexacorp.com.pg
Mon Dec 5 21:22:25 CST 2011
You can set me.Visible = False instead of closing the form. How to garbage collect and subsequently close the hidden form is left as an exercise for the reader. :-) -- Stuart On 5 Dec 2011 at 21:41, Benson, William (GE Global Re wrote: > Sorry, I cannot make my statement about "dangerous to use" very clear at > this time. Essentially, if the form is open and a certain value has > changed (say, for example, a user's privileges have changed from one > class to another) then I do not want them able to see the form that they > had been looking at. So it was on the activate event that this was to be > checked for. > > That is not the exact condition, it is a representative example. > > To answer Charlotte's question: > > "this action cannot be carried out while processing a form or report > event" > > Here is a sample of code you can put in a form that is already opened: > > Private Sub Form_Activate() > If 1 = 2 Then DoCmd.Close acForm, Me.Name > End Sub > > > Launch the form, then deactivate it by opening a different form. > > Change the code to > If 1 = 1 Then DoCmd.Close acForm, Me.Name > > Click back on the first form, you will get this error message. > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com >