Solved Use MouseUp and MouseDown (1 Viewer)

mloucel

Member
Local time
Today, 04:01
Joined
Aug 5, 2020
Messages
153
Hello ALL,

I have a routine that allows my users [admins] to be able to see the password of another user to change/update, and I use a check box control, works super good, but I want to make it a bit better using MouseDOWN and MouseUP but my brain doesn't figure out how to do it.

Here is my actual code:
Code:
Private Sub ShowPassw_Click()

    If ShowPassw Then
        If LoginID.Value = 1 And TempVars("SA").Value <> "True" Then
            Password.InputMask = "Password"
            ShowPassw.Value = False
            If Form.Dirty Then
                DoCmd.RunCommand acCmdUndo
            End If
            MsgBox "This user cannot be updated for security..", vbCritical + vbOKOnly, "User Locked"
            Me!btnClose.SetFocus
            Exit Sub
        End If

        ShowPassw.Value = True
        Password.InputMask = ""
    Else
        ShowPassw.Value = False
        Password.InputMask = "Password"
    End If

End Sub

I am willing to change the check box for whatever else, any Ideas will be appreciated.

I already tried simply using this instead but is a little disaster it doesn't work since the check keeps either checked or unchecked and me frustrated.
thanks..

Code:
Private Sub ShowPassw_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

    If ShowPassw Then
        If LoginID.Value = 1 And TempVars("SA").Value <> "True" Then
            Password.InputMask = "Password"
            ShowPassw.Value = False
            If Form.Dirty Then
                DoCmd.RunCommand acCmdUndo
            End If
            MsgBox "This user cannot be updated for security..", vbCritical + vbOKOnly, "User Locked"
            Me!btnClose.SetFocus
            Exit Sub
        End If

        ShowPassw.Value = True
        Password.InputMask = ""
    End If


End Sub

Private Sub ShowPassw_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    
        ShowPassw.Value = False
        Password.InputMask = "Password"

End Sub
 

Cronk

Registered User.
Local time
Today, 21:01
Joined
Jul 4, 2013
Messages
2,772
Where is ShowPassw set to True initially?
 

mloucel

Member
Local time
Today, 04:01
Joined
Aug 5, 2020
Messages
153
Where is ShowPassw set to True initially?
1) Login Form [here ShowPass=False] then
2) Menu Form FormLoad()
3) on the menu I have an option to EDIT Users/Passwords..
so initially is false so that I avoid any issues [out of abundance of worry], then within the code I check if the logged user is THE SUPERUSER or a REGULAR admin who by default does not have nor will ever have access to the SUPERUSER password.
 

Cronk

Registered User.
Local time
Today, 21:01
Joined
Jul 4, 2013
Messages
2,772
So when you click the button and execute the sub ShowPassw_Click, the value for ShowPassw is false and nothing happens?
 

mloucel

Member
Local time
Today, 04:01
Joined
Aug 5, 2020
Messages
153
So when you click the button and execute the sub ShowPassw_Click, the value for ShowPassw is false and nothing happens?

Well I solved it, just get rid of the check box and add a button, problem solved.
 

Cronk

Registered User.
Local time
Today, 21:01
Joined
Jul 4, 2013
Messages
2,772
Glad you got it sorted.
 

Users who are viewing this thread

Top Bottom