Solved InputBox with Asterix (1 Viewer)

mike60smart

Registered User.
Local time
Today, 22:20
Joined
Aug 6, 2017
Messages
1,910
Hi Everyone
I am trying to use the Code shown in the following previous thread

When I run the Code I get the error shown Below.

Code:
Private Sub cmdAdmin_Click()

On Error Resume Next
    Dim pWord As String
    pWord = InputBoxDK("Enter Administrative Password", "Password Required!")
    If pWord = "" Then
        MsgBox "Nothing Entered" & vbCrLf & vbLf & "Please Contact Your Local Administrator", vbCritical, "Security Logging"
        GoTo ExitInput:
    End If
    If pWord = SCtb0825 Then 'password is correct (password of your choice)
        DoCmd.OpenForm "Administration"
    Else
       MsgBox "Incorrect Password!" & vbCrLf & vbLf & "Please Contact Your Local Administrator", vbCritical, "Security Logging"
       Exit Sub
    End If
ExitInput:
End Sub

Can anyone tell me where I am going wrong with this?
Any help appreciated.
 

Attachments

  • Error.PNG
    Error.PNG
    33.3 KB · Views: 72

XPS35

Active member
Local time
Today, 23:20
Joined
Jul 19, 2022
Messages
159
If pWord = "SCtb0825" ?
 

isladogs

MVP / VIP
Local time
Today, 22:20
Joined
Jan 14, 2017
Messages
18,233
See my article:
 

Gasman

Enthusiastic Amateur
Local time
Today, 22:20
Joined
Sep 21, 2011
Messages
14,310
Hi Everyone
I am trying to use the Code shown in the following previous thread

When I run the Code I get the error shown Below.

Code:
Private Sub cmdAdmin_Click()

On Error Resume Next
    Dim pWord As String
    pWord = InputBoxDK("Enter Administrative Password", "Password Required!")
    If pWord = "" Then
        MsgBox "Nothing Entered" & vbCrLf & vbLf & "Please Contact Your Local Administrator", vbCritical, "Security Logging"
        GoTo ExitInput:
    End If
    If pWord = SCtb0825 Then 'password is correct (password of your choice)
        DoCmd.OpenForm "Administration"
    Else
       MsgBox "Incorrect Password!" & vbCrLf & vbLf & "Please Contact Your Local Administrator", vbCritical, "Security Logging"
       Exit Sub
    End If
ExitInput:
End Sub

Can anyone tell me where I am going wrong with this?
Any help appreciated.
Pretty simple really, password does not match sc whatever as you have not have declared it or made available to that function/sub.

Whose db is this you are working on?
 

Gasman

Enthusiastic Amateur
Local time
Today, 22:20
Joined
Sep 21, 2011
Messages
14,310
Never mind, the actual owner of the db has replied elsewhere. :)


 

mike60smart

Registered User.
Local time
Today, 22:20
Joined
Aug 6, 2017
Messages
1,910
Hi Gasman

Yes that example provided by Isladogs works fine
 

Cotswold

Active member
Local time
Today, 22:20
Joined
Dec 31, 2020
Messages
528
I had a customer who moaned on and on about having to enter a password to open the program and how he couldn't see the characters he typed in. He was such a pain every time I went, or when we spoke on the phone and wouldn't pay to have our updated password entry with switch added to see what he'd typed. Because of his attitude and on general principles I wouldn't update him for free. In the end I told him to change his password to eight asterisks. He could still be using that same password.


(P.S. Asterix is a fat little cartoon character in stripy trousers)
 
Last edited:

D_Walla

Member
Local time
Today, 22:20
Joined
Aug 1, 2021
Messages
32
(P.S. Asterix is a fat little cartoon character in stripy trousers)
Asterix was indeed a little cartoon character, but it was Obelix who was the fat one with the stripy trousers. :) #justsaying
 

Users who are viewing this thread

Top Bottom