password for command button?

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
0
Utf
1/4/2008 7:34:01 PM
access.formscoding 7493 articles. 0 followers. Follow

7 Replies
1515 Views

Similar Articles

[PageSpeed] 25

On Jan 4, 11:34 am, Debbie S. <Debb...@discussions.microsoft.com>
wrote:
> 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
0
Minton
1/4/2008 8:10:10 PM
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

"Minton M" wrote:

> On Jan 4, 11:34 am, Debbie S. <Debb...@discussions.microsoft.com>
> wrote:
> > 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
> 
0
Utf
1/4/2008 8:53:03 PM
On Jan 4, 12:53 pm, Debbie S. <Debb...@discussions.microsoft.com>
wrote:
> 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
>
> "Minton M" wrote:
> > On Jan 4, 11:34 am, Debbie S. <Debb...@discussions.microsoft.com>
> > wrote:
> > > 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

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
0
Minton
1/4/2008 9:00:50 PM
On Jan 4, 1:53=A0pm, Debbie S. <Debb...@discussions.microsoft.com>
wrote:
> 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 shoul=
d
> enter the code you suggested below (in the code builder)? Or do you mean
> something else?
>
> Thanks again,
> Debbie
>
>
>
> "Minton M" wrote:
> > On Jan 4, 11:34 am, Debbie S. <Debb...@discussions.microsoft.com>
> > wrote:
> > > Is there a way to code a command button in its on click event that wil=
l
> > > 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()
> > =A0 =A0If inputbox("Enter password:")=3Dm_sSomePassword then
> > =A0 =A0 =A0 ... do the operation
> > =A0 =A0end 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- Hide quoted text -
>
> - Show quoted text -

That is the place.
0
Ron2006
1/4/2008 9:00:56 PM
Thank you Ron2006

"Ron2006" wrote:

> On Jan 4, 1:53 pm, Debbie S. <Debb...@discussions.microsoft.com>
> wrote:
> > 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
> >
> >
> >
> > "Minton M" wrote:
> > > On Jan 4, 11:34 am, Debbie S. <Debb...@discussions.microsoft.com>
> > > wrote:
> > > > 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- Hide quoted text -
> >
> > - Show quoted text -
> 
> That is the place.
> 
0
Utf
1/4/2008 9:31:01 PM
Thank you! 
"Minton M" wrote:

> On Jan 4, 12:53 pm, Debbie S. <Debb...@discussions.microsoft.com>
> wrote:
> > 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
> >
> > "Minton M" wrote:
> > > On Jan 4, 11:34 am, Debbie S. <Debb...@discussions.microsoft.com>
> > > wrote:
> > > > 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
> 
> 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
> 
0
Utf
1/4/2008 9:31:01 PM
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 

"Minton M" wrote:

> On Jan 4, 12:53 pm, Debbie S. <Debb...@discussions.microsoft.com>
> wrote:
> > 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
> >
> > "Minton M" wrote:
> > > On Jan 4, 11:34 am, Debbie S. <Debb...@discussions.microsoft.com>
> > > wrote:
> > > > 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
> 
> 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
> 
0
Utf
1/4/2008 9:41:01 PM
Reply:

Similar Artilces:

search command
Hi there, i have a form where i would like to use for search by two criterias: Lot# or Part Number - these are two field in the table. need help to add that to the code Private Sub Command39_Click() End Sub Private Sub Command42_Click() On Error GoTo Err_Command42_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "Open Orders" stLinkCriteria = "[PART NUMBER]=" & "'" & Me![PART NUMBER] & "'" DoCmd.OpenForm stDocName, , , stLinkCriteria Exit_Command42_Click: E...

Command button
[Excel 2003] I have command buttons on the userform which access other userforms (which drive the spreadsheet data entry) I have a listbox on the userform displaying a number. I would like to enter code into the command button activations such that if the number in the listbox does not equal the number stored within the code of the command button then a mesage box is displayed and the command button does not activate its sub routines. Can anyone help? Thanks, Roger Something like this: Option Explicit Public Property Get MayProceed() As Boolean Const M...

macro button on spreadsheet
I know how to create a macro and how to attach it to a button on the toolbar. What I would like to do is place a button out on the worksheet to run the macro. When I follow the directions in help it doesn't work. THANKS for the help. I am using Excel 2002. Can you be more specific about what you mean by "it doesn't work"? Are you able to create the button? How did you create the button -- via the Forms toolbar or the Controls Toolbox? Can you create it but don't know how to tell it to run your macro? On Thu, 28 Oct 2004 21:07:01 -0700, "SheriTingle" <Sh...

greyed out close button
I have Excel 2002 and cannot figure out why the close button is greye out. Can anyone tell me how to active this button. thank ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com I have a greyed out close button and a co-worker has a greyed out minimize button. If you find out what to do please let me know. Thanks >-----Original Message----- > >I have Excel 2002 and cannot figure out why the close button is greyed >out. Can anyone tell me how to active this...

align left and align right buttons greyed out
command buttons for left align and right align are permanently greyed out. Default for new docs is left align so not much problem but there is no way to right align. I am using Word 2007. Any ideas? ...

Passwords
Hi, I have a password field in a database. How do I set it so that a user can only type in 7 characters for a password. and if they type more an error message will appear? Please hi, Daz01 wrote: > Hi, I have a password field in a database. How do I set it so that a > user can only type in 7 characters for a password. and if they type > more an error message will appear? You may use the ValidationRule and ValidationText of the field in the table design view. Setting ValidationRule to Len([YourField])>7) will raise an error in your case. mfG --> stefan <-- ...

Money "forgets" passwords for online account updates
I am using Money Plus Deluxe. Sometimes but not always, when I try to update my account online transactions it forgets a couple of the passwords. This is not always the same account nor does it happen with any pattern I can see. Any fix and does anyone else see this problem? ...

Relabeling buttons
Does anyone know of a way that the "Sales - Sales Automation" button can be modified so that it reads "Client Services"? Is there a particular file this would need to be changed in or is this all hardcoded? Thanks. This information is stored in resource dll's. By doing this Microsoft have the ability to target the app at different languages. If you read the archive of this group on google at groups.google.com you will find that it is possible to modify the resource file for Microsoft CRM. Bear in mind that making this change is unsupported and therefore if you have...

Password Cell Protection
Morning all. I'm seeking to protect specific cells within a given worksheet. I've been reading some of the newer posts on the topic, and see that I'm to first go in, unlock cells that I want accessible, and then once all cells are configured- locked or unlocked state- I go to the Review Tab, select Protect Sheet, choose the options I want users to have access to, and select/enter the desired password- twice. Once I do this, all appears to be as desired, until I try to insert or delete a row-- something I'd specifically allowed for on my unlocked cells/rows. ...

Option Buttons 06-21-07
If I choose a Control Source I can get the option buttons to work. Can you help? -- Dick Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200706/1 Do you want us to push the button? What is the problem? UpRider "richardlafrance via AccessMonster.com" <u31432@uwe> wrote in message news:740b97593dc91@uwe... > If I choose a Control Source I can get the option buttons to work. Can > you > help? > > -- > Dick > > Message posted via AccessMonster.com > http://www.accessmonster.com/Uwe/Forums.aspx/ac...

Keyboard commands
I have a user who is blind. I am looking for a list of keyboard commands since he is unable to use the mouse. Glenda, See http://www.cpearson.com/excel/shortcuts.htm . -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Glenda Johnston" <anonymous@discussions.microsoft.com> wrote in message news:9A9DC1C0-730F-4D48-826F-7B37FDDB36CA@microsoft.com... > I have a user who is blind. I am looking for a list of keyboard commands since he is unable to use the mouse. > ...

SQL Command match Items to Matrix
SQL command that will put all items which contain a certain Supplier ID # to be added to a matrix that I have created. We have a company and we want to do a matrix for all of there items. But instead of manually adding each item to the matrix. If I could run an SQL command that will take all items with the supplier ID attached to them and have them added to the matrix. I am aware that I will still have to label the dimensions. It would just be fantastic if I could do a mass add. Hopefully someone has a creative mind. I tried some commands, but I am not an SQL master either. I know that ...

Save file as readonly with password
is there a way for access to export a file to word (.rtf) as a read only file with a built in password to unprotect it? -- Message posted via http://www.accessmonster.com ...

Force TRUE in a check box as result from an option button??
I have a set of option buttons and a set of check boxes. One of the check boxes is for a certain value that is similar to one of the option buttons. Essentially, what I want is for that check box to automatically go to a "TRUE" (checked) state when the certain option button is selected. When the other option buttons are selected, the check box will remain in it's normal state which will allow the user to select it or not depending on other variables. But, if the option button is on that certain selection, I would like to make it so that check box MUST remain on TRUE, and ...

Print Button
On my summary tab, I want to add a print button command that will print the entire work book if the button is pushed. How do I add the print button? Hi, First do the print setup for all the tabs then write a macro to print each tab create a button in summary sheet using toolbox assign the macro to this button Ratheesh ...

Command Button Wizard 02-14-08
Using Access 2000, I have built an extensive database, & the command buttons built with the Wizard all work. All simple commands, such as Print, Find Record, etc. I build another database (ostensibly with all the same settings) and the command buttons built with the Wizard will not work - none of them - when clicking on such a button, it depresses, but nothing happens. I build another database, and the command buttons built with the Wizard all work. Why? What variable is available that apparently switches off all the buttons? The macro code established by the Wizard in a db th...

why can't i find the send button and how do I configure e-mail
I seem to be able to write the e-mail but do not have a button to send. the message tells me my address is not configured? Did you create a profile for Outlook to use? http://www.howto-outlook.com/faq/newprofile.htm "LJDICKER" <LJDICKER@discussions.microsoft.com> wrote in message news:211018AE-F489-4002-864E-FAEEC141AF6F@microsoft.com... > I seem to be able to write the e-mail but do not have a button to send. the > message tells me my address is not configured? ...

Printable Quote Button
I am prepairing for the upgrade to CRM 3.0. I have been using 1.2 with a custom crystal report that runs from a "printable quote" button and associated .aspx file so I can produce a "professional" quote for our customers. Now that the reporting is going to SQL reporting services, I know I have to convert or re-write my quote form under SRS. I am also believe that my .aspx file that passes the QuoteId and quote report will also have to change. Does anyone know what changes are needed for this conversion? Further, is there a better way with 3.0 to generate the pri...

Visual Basic sub routine command??
Can anyone tell me what the command is to call another macro from within an existing macro? I am using Excel 98 for Macintosh For example, I am running Sub Macro (9) and I want to run Sub Macro (10). I have tried recording a macro and selecting Tool Macro Macros.. ...

Pass command line file name parameter
Hi, I have an application with classes Myapp, MyappDoc and MyappView. The input filename from command line's parameter is stored as public variable sFilename in Myapp.h which is included in MyappDoc.cpp and MyappView.cpp. There're compiling errors: MyappDoc.cpp : error C2065: 'sFilename' : undeclared identifier MyappView.cpp : error C2065: 'sFilename' : undeclared identifier Why? If the input filename from command line's parameter is stored as public variable in MyappDoc.h, how to access it from Myapp.cpp? Thanks, ybc The other problem is, when I set the...

Button fails to call macro when open an Excel via Intranet
Hi all, Can someone help me with my with this problem. I have an Excel file with a button to run a small macro: unhide and displys worksheets. It works when the file is opened with Excel. The macro is simple: Sub Button1_Click() Sheets("FF").Visible = True Sheets("FF").Select Range("C1").Select End Sub I need to open it from an intranet site. When user selects the file, the web app retrieves the file and responses to open an Excel file. But on the intrenet I get the following error massage "The macro "GenerateResource.aspx?Resour...

Forgotten Password #4
I need to gain access to my Money 2001 that I have on an old computer but have forgotten the password that I used back then. Is there any way I can find out what my password was? Does anyone know what file the password is kept in and if it's readable? Any help will be appreciated since it's very important that I retrieve some information from that year which I did not carry forward to the more current years. Thank you! You might be able to find a company which provides software to get the password out for you. I know of three, but there are probably others. http://money.mvps.org/faq...

Dialog Form Enabling OK button
Please help with a conceptual problem... I have an unbound dialog form that I call up for the user to enter a couple of values that will then be used for some calculations. I don't want the OK button to enable until all the text boxes are filled in. Normally, I would include a data check routine that would get called from the afterupdate event on each text box. If all the text boxes had a value (that was inside predetermined ranges), the OK button would be enabled, otherwise not. Pretty standard stuff... Now, one pesky user has complained that after he's done entering the last va...

Adding a password to a reminder?
This is a family PC which several of us use. Outlook 2002, XP ProSP2. There have been a couple of occasions when one of us have set a reminder in Calendar, but it has popped up when another user is at the machine. Teenagers being what they are, they don't appreciate the importance to someone else, and its been 'dismissed'. The Mum misses a deadline cos no-one reminded her.... I realise the answer to this lies in our helping one another out - and I'm creasonably confident that will happen - but I wonder if as a failsafe I can prevent an item being dismissed in some way...

password for ActSys32
I installed frx. I tried to open ActSys32.mdb but the system is prompting me for a password. Any idea on what the password should be here. Officially, only Support has this password. "Jack" wrote: > I installed frx. I tried to open ActSys32.mdb but the system is prompting me > for a password. Any idea on what the password should be here. If you have it, please email me. jacktundra@hotmail.com "Charles Allen" wrote: > Officially, only Support has this password. > > "Jack" wrote: > > > I installed frx. I tried to open ActSys32.md...