Load/Unload Forms (1 Viewer)

npierson

Registered User.
Local time
Today, 22:21
Joined
May 14, 2001
Messages
42
I am trying to prompt for a password on first run of a form. If the password is correct a certain form will load, and if not, a different form will load. I know how to prompt (stName = InputBox("Enter Password:")) and evaluate the validity of the string (or any other data type), but what function should I put this in, and what code should I use to unload the current form and load a different form?

I would really appreciate any help,

Nick
 

charityg

Registered User.
Local time
Today, 22:21
Joined
Apr 17, 2001
Messages
634
Create a custom popup form for the password entry instead of using input box. Then use the openform of docmd on the enter or click of an OK command that you add to the form. Don't forget to add the close command for the password form after opening the other form.
 

npierson

Registered User.
Local time
Today, 22:21
Joined
May 14, 2001
Messages
42
How do I create a custom pop-up password?

Thanks,

Nick
 

charityg

Registered User.
Local time
Today, 22:21
Joined
Apr 17, 2001
Messages
634
Create a form with an unbound textbox and input mask of password. Set the form to popup. Place OK and Cancel command buttons on the form. In the OnClick event of the OK button use something like:

If txtPassword="YourPassword" then
docmd.openform "YourFormName"
docmd.close acform "ThisFormName"
else
docmd.openform "OtherFormName"

endif

Then in the OnClick event of the cancel button use
docmd.close acform, "ThisFormName"

[This message has been edited by charityg (edited 06-04-2001).]
 

npierson

Registered User.
Local time
Today, 22:21
Joined
May 14, 2001
Messages
42
I can't thank you enough for all this help; however, the following line of code always receives an error: docmd.close acform "ThisFormName"

Everything else works great, but I can't seem to figure this out.

Thanks again,

Nick
 

npierson

Registered User.
Local time
Today, 22:21
Joined
May 14, 2001
Messages
42
I used the current form (with the password) for "This Form Name" by the way.

[This message has been edited by npierson (edited 06-04-2001).]
 

npierson

Registered User.
Local time
Today, 22:21
Joined
May 14, 2001
Messages
42
I really need to figure this out ASAP so please, if you can, help me out on this one problem.

Thanks
 

Users who are viewing this thread

Top Bottom