Form Code

crcastilla

Registered User.
Local time
Today, 08:49
Joined
Aug 20, 2011
Messages
21
I want to know if this is possible.

I have a check box name "Sales". I want it so whenever I try to check the box it will ask me for a password. If I input the incorrect password then the box will not be checked. If I put the correct one then it will be checked. Let's say the password to check it is "A". Notice I say it is the password to CHECK it. Is there a way so that if I wanted to unchecked it, it will ask me for another password. (Ex. "B")

Now, I have another box next to this check box. Is there a way so that whenever I am able to check the box I was talking about above this box will show the current date that the box was checked?

It sounds very complicated, at least to me but there is bunch of codes I have no ideas about.

Please anyone help.
 
Copy and paste the code below into the After Update event of your check box:
Code:
Dim strInputVal As String

If Me.Sales = True Then
    strInputVal = InputBox("Enter your Password", "Password ...")
    If strInputVal <> "MyName" Then
        Me.Sales = False
    End If
Else
    strInputVal = InputBox("Enter your Password", "Password ...")
    If strInputVal <> "Other" Then
        Me.Sales = True
    End If
End If

If the user is checking the check box and the password of "MyName" is entered then the check box will be checked. If the "MyName" is not entered then the check box will be unchecked.

It the user unchecks the check box and "Other" is entered as the password the check box will be unchecked. If "Other" is not entered, the check box will be checked.

Using this code, the passwords are not case sensitive.
 
thank you so much,

is there also a way to accomplish my second question?
so that the check box it is checked it will appear in another box the date that it was checked?
 
Sorry, I did not include that in my initial response:

Assuming that you have a text box named "txtDateChecked" and the Visible property of that text box is set to false and the Locked property is set to True you can replace the code I posted previously with the code below:
Code:
Dim strInputVal As String

If Me.Sales = True Then
    strInputVal = InputBox("Enter your Password", "Password ...")
    If strInputVal <> "MyName" Then
        Me.Sales = False
        Me.txtDateChecked.Visible = False
    Else
        With Me.txtDateChecked
            .Visible = True
            .Value = Date
        End With
    End If
Else
    strInputVal = InputBox("Enter your Password", "Password ...")
    If strInputVal <> "Other" Then
        Me.Sales = True
    Else
        With Me.txtDateChecked
            .Value = Null
            .Visible = False
        End With
    End If
End If
 

Users who are viewing this thread

Back
Top Bottom