password for command button?

  • Thread starter Thread starter Debbie S.
  • Start date Start date
D

Debbie S.

Is there a way to code a command button in its on click event that will
prompt the user to enter a password to perform the command button's
operation?

Thank you.

-Debbie
 
Is there a way to code a command button in its on click event that will
prompt the user to enter a password to perform the command button's
operation?

Thank you.

-Debbie

Yes, but you'll need to delve into VBA. Attach a click event to the
button and in the code:

Public Function Button1_Click()
If inputbox("Enter password:")=m_sSomePassword then
... do the operation
end if
end function

m_sSomePassword has to be declared somewhere and presumably looks up
the password from a table.

This is of course is not very pretty or secure but the same method can
be applied whether you use a form dialog, DB lookup or whatever. The
key question is where you're going to keep your password securely.
Then you start getting into MD5, one-way hashes and all sorts of
excitement.

-- James
 
Thank you! When you say "attach a click event to the button," do you mean in
the property sheet of the command button, in the "on click" event, I should
enter the code you suggested below (in the code builder)? Or do you mean
something else?

Thanks again,
Debbie
 
Thank you! When you say "attach a click event to the button," do you mean in
the property sheet of the command button, in the "on click" event, I should
enter the code you suggested below (in the code builder)? Or do you mean
something else?

Thanks again,
Debbie

In the property sheet, click the elipsis (...) symbol and select Event
Procedure to start building the event. To be honest, if you're not
very familiar with this, I would steer clear from this implementation
since any amateur user will be able to open your code, see the
password and bypass your security.

This is the first time in years I've used the word 'elipsis', by the
way. :-)

-- James
 
Thank you! When you say "attach a click event to the button," do you mean in
the property sheet of the command button, in the "on click" event, I should
enter the code you suggested below (in the code builder)? Or do you mean
something else?

Thanks again,
Debbie










- Show quoted text -

That is the place.
 
Thank you!
Minton M said:
In the property sheet, click the elipsis (...) symbol and select Event
Procedure to start building the event. To be honest, if you're not
very familiar with this, I would steer clear from this implementation
since any amateur user will be able to open your code, see the
password and bypass your security.

This is the first time in years I've used the word 'elipsis', by the
way. :-)

-- James
 
James, you have been very helpful, thank you. I have another question on a
different access topic. I just tried to use the user level security wizard.
It created the .bak copy, and I could see the path it was in, but now that
file is nowhere to be found; in addition, when I try to open the database, I
get the message "you do not have the necessary permissions to use the 'file
path and name of database here' object. Have your system administrator or the
person who created this object establish the appropriate permissions for
you." The person who created the object is me. I was already assigned as the
admin automatically. I must have missed something. Luckily I tried this in a
copy so I can throw this out and try again on another copy, which is what I
will have to do. What is the difference between creating user level access
that requires a log on, and creating user level access that does not require
a log on? What did I miss? Any suggestions? Thank you again.
Debbie
 
Back
Top