Forcing Current Event to Fire?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a several forms where I have set AllowEdits & AllowAdditions to False.
In order to edit or add records, I have created a pop-up form that prompts
the user for a password to edit. If the correct password is entered, the
pop-up gets hidden (me.visible = false) and I have the following code in the
OnCurrent Event of several forms:

If Not IsLoaded("frmPasswordPrompt") then
Me.AllowAdditions = False
Me. AllowEdits = False
Else
Me.AllowAdditions = True
Me.AllowEdits = True
End if

It works fine except since the password pop-up gets launched from a button
on the custom menu bar, the user has to move to the next record in order to
cause the OnCurrent Event to fire on the current form after entering the
password so that edits & additions will be allowed.

Is there a better way to handle this? Should I maybe also put this code in
the GotFocus event of the forms? Any suggestions are appreciated. I prefer
not to use Access security features. Thanks!
 
Sandie,

Assuming you have one login for your app, I would:

1. Make the login form the Display form under Tools, Startup... This
way users see it first, before any other forms open.

2. Move your checking code from OnCurrent to OnOpen in your other
forms.

3. On your custom menu bar, hide buttons that open up other forms until
your user logs in. After a successful login, show the other form
buttons, and disable the login button.

-Ken
 
I would try putting the code you have below in the Got Focus event of the
forms you are using this way.
 
I have a security system I wrote that takes a similar approach. The start up
form is the login form. The user enteres a name and password, The first
thing that happens is that it checks to see if the link to the backend is
good. I have to do that or the entries could not be validated. If the link
is lost, A common dialog box opens and allows the user to navigate to the
back end. If the back end is the right one, it reestablishes the links.

Then the entries are validated against a security table that is encrypted
using an encryption routine I wrote. If the user is validated, 2 new
application level properties are created. User Name and User Access Level.

For each form in the system, in the Open event, there is a routine that
checks the user level property to determine whether they can view or edit the
form. Then the controls on the form are locked or disabled or whatever is
appropriate for the user.
 
Back
Top