Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: [Access] Retaining a public variable from one form to another


Message #1 by "Brian Paniccia" <bpanicci@n...> on Thu, 8 Mar 2001 16:04:28 -0500
I am using a form as a dialogue box for a user to input a pin number 

with the password mask over the field



the form I call this security form from is a form of buttons (a 

switchboard essentially).  Before I open the security form



the public variable pubSecurity is set to false first, if the user 

populates the text-box with the password format with the correct

pin # and presses OK (another button) the pubSecurity var is set to true 

and the form is closed returning focus back to the calling menu form.



The problem is the button click code that opens it is not resumed and 

the following logic if pubSecurity =3D true then Do.Cmd Open

the form that requires a password is never reached



Any advice or should I use an on-gets focus type of from event on the 

menu form (calling one ) to constantly check for pubSecurity becoming 

true then it knows to open the form that I need to prompt for a password 

first.

Any Ideas would help, I think I might have answered my own question 

though.



I guess this typifies an Event vs. Step driven environment



Brian

Message #2 by "Pardee, Roy E" <roy.e.pardee@l...> on Thu, 08 Mar 2001 13:28:13 -0800
To get your code to pause while the user interacts w/your password dialog

form, set the WindowMode argument of the OpenForm method to acDialog--e.g.,



DoCmd.OpenForm FormName:="frmPassword",  WindowMode:=acDialog



This will pause things until frmPassword is closed or hidden.



To keep the value of the pwd box in memory for use elsewhere, don't ever

actually close the dialog form--just set it's .Visible property to False.



HTH,



-Roy



-----Original Message-----

From: Brian Paniccia [mailto:bpanicci@n...]

Sent: Thursday, March 08, 2001 1:04 PM

To: Access

Subject: [access] [Access] Retaining a public variable from one form to

another





I am using a form as a dialogue box for a user to input a pin number 

with the password mask over the field



the form I call this security form from is a form of buttons (a 

switchboard essentially).  Before I open the security form



the public variable pubSecurity is set to false first, if the user 

populates the text-box with the password format with the correct

pin # and presses OK (another button) the pubSecurity var is set to true 

and the form is closed returning focus back to the calling menu form.



The problem is the button click code that opens it is not resumed and 

the following logic if pubSecurity =3D true then Do.Cmd Open

the form that requires a password is never reached



Any advice or should I use an on-gets focus type of from event on the 

menu form (calling one ) to constantly check for pubSecurity becoming 

true then it knows to open the form that I need to prompt for a password 

first.

Any Ideas would help, I think I might have answered my own question 

though.



I guess this typifies an Event vs. Step driven environment



Brian






Message #3 by BPulliam@B... on Fri, 9 Mar 2001 08:09:43 -0600

There's a million different ways to skin a cat......



You may want to set a public variable in a module instead.



Public LoginN as String

Public LoginP as String

Public LoginL as String





What I usually do is capture who is logging in, Their password, and their

Security Level right at the beginning when they open the database.



Rough Example



LoginN= me.combo5.value

LoginP= me.text01.value



You can set loginL (Login Level) by referencing a table where you keep the

available login names and security levels.





I can then use this information to enable or disable controls throught

application at the Form or individual level.



Rough Ex:



IF  LoginL = "1"    Then



     me.form.allowedits = true



ELSE



     me.form.allowedits=false



End IF



All this only works to control access if you lock down the rest of the

database.





Just another approach, hope it helps,





Brian Pulliam

Berkley Risk Administrators Company, LLC



Murphy's Technology Laws: "It is impossible to make anything foolproof

because fools are so ingenious."







                                                                                            

                    "Pardee, Roy                                                            

                    E"                   To:     "Access" <access@p...>             

                    <roy.e.pardee        cc:                                                

                    @lmco.com>           Subject:     [access] [Access] Retaining a public  

                                         variable from one form to another                  

                    03/08/01                                                                

                    03:28 PM                                                                

                    Please                                                                  

                    respond to                                                              

                    "Access"                                                                

                                                                                            

                                                                                            









To get your code to pause while the user interacts w/your password dialog

form, set the WindowMode argument of the OpenForm method to acDialog--e.g.,



DoCmd.OpenForm FormName:="frmPassword",  WindowMode:=acDialog



This will pause things until frmPassword is closed or hidden.



To keep the value of the pwd box in memory for use elsewhere, don't ever

actually close the dialog form--just set it's .Visible property to False.



HTH,



-Roy



-----Original Message-----

From: Brian Paniccia [mailto:bpanicci@n...]

Sent: Thursday, March 08, 2001 1:04 PM

To: Access

Subject: [access] [Access] Retaining a public variable from one form to

another





I am using a form as a dialogue box for a user to input a pin number 

with the password mask over the field



the form I call this security form from is a form of buttons (a 

switchboard essentially).  Before I open the security form



the public variable pubSecurity is set to false first, if the user 

populates the text-box with the password format with the correct

pin # and presses OK (another button) the pubSecurity var is set to true 

and the form is closed returning focus back to the calling menu form.



The problem is the button click code that opens it is not resumed and 

the following logic if pubSecurity =3D true then Do.Cmd Open

the form that requires a password is never reached



Any advice or should I use an on-gets focus type of from event on the 

menu form (calling one ) to constantly check for pubSecurity becoming 

true then it knows to open the form that I need to prompt for a password 

first.

Any Ideas would help, I think I might have answered my own question 

though.



I guess this typifies an Event vs. Step driven environment



Brian


  Return to Index