sanand
07-30-2002, 12:33 PM
Hi there,
I am trying to hide or unhide a cmd button based on the
user password entry.
Here's what I want:
If the password is "super" then make the cmdEdit
button visible, if the pw is "view" hide this button,
and if none of these two, then display an error
message. Here is code I'm using:
****** Code starts here ********
Private Sub OK_Click()
On Error Resume Next
Select Case txtPassword.Text
Case "super"
frmMain.Show
frmMain.cmdEdit.Visible = True
Me.Hide
Case "view"
frmMain.Show
frmMain.cmdEdit.Visible = False
Me.Hide
Case Else
MsgBox "Invalid User Name and Password, try again!", , "Login - Try Again"
txtPassword.SetFocus
SendKeys "{Home}+{End}"
End Select
End Sub
****** end of the code ********
When I enter the "view" (without quotes) as pw,
it does not hide the cmdEdit button.
Any help with this code is appreciated.
TIA
I am trying to hide or unhide a cmd button based on the
user password entry.
Here's what I want:
If the password is "super" then make the cmdEdit
button visible, if the pw is "view" hide this button,
and if none of these two, then display an error
message. Here is code I'm using:
****** Code starts here ********
Private Sub OK_Click()
On Error Resume Next
Select Case txtPassword.Text
Case "super"
frmMain.Show
frmMain.cmdEdit.Visible = True
Me.Hide
Case "view"
frmMain.Show
frmMain.cmdEdit.Visible = False
Me.Hide
Case Else
MsgBox "Invalid User Name and Password, try again!", , "Login - Try Again"
txtPassword.SetFocus
SendKeys "{Home}+{End}"
End Select
End Sub
****** end of the code ********
When I enter the "view" (without quotes) as pw,
it does not hide the cmdEdit button.
Any help with this code is appreciated.
TIA