Nan, Set up a form called frmPassword or name of your choice and
insert following code into it. Place textbox and cancel button on
it. Open this form with the button on your main menu. Jim
Option Compare Database
Option Explicit
Sub btnCancel_Click()
On Error GoTo Err_btnCancel_Click
If btncancel.Caption = "Cancel" Then
DoCmd.Close
Else
If btncancel.Caption = "Continue" Then
DoCmd.Close
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmPasswordProtectedForm"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
End If
Exit_btnCancel_Click:
Exit Sub
Err_btnCancel_Click:
MsgBox Err.Description
Resume Exit_btnCancel_Click
End Sub
Sub btnPasswordProtectedFormButton_Click()
On Error GoTo Err_btnPasswordProtectedFormButton_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmPasswordProtectedForm"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_btnPasswordProtectedFormButton_Click:
Exit Sub
Err_btnPasswordProtectedFormButton_Click:
MsgBox Err.Description
Resume Exit_btnPasswordProtectedFormButton_Click
End Sub
Private Sub txtPassword_AfterUpdate()
If txtPassword.Value = "password" Then
btncancel.Caption = "Continue"
btnCancel_Click
Else
btncancel.Caption = "Cancel"
End If
End Sub
Hope that helps.
--- In [email protected], "iamnannan"
<[EMAIL PROTECTED]> wrote:
> Dear All,
>
> Does anyone know how to set up a password for a command button on
the
> Main Switch Board? Thank you for your help
>
> Nan
------------------------ Yahoo! Groups Sponsor --------------------~-->
<font face=arial size=-1><a
href="http://us.ard.yahoo.com/SIG=12h13cp5f/M=362329.6886308.7839368.1510227/D=groups/S=1705115370:TM/Y=YAHOO/EXP=1123605967/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992
">Fair play? Video games influencing politics. Click and talk back!</a>.</font>
--------------------------------------------------------------------~->
Please zip all files prior to uploading to Files section.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AccessDevelopers/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/