Password Protecting Fields

B

bokims

I want signature blocks on my form only accessible to the person who signed
in. I have user level security so the person must sign in to have access to
the form but beyond that I only want that person to be able to fill his/her
name in, in their spot only to show agreement - electronic signature. I have
this on one form but cant duplicate it on the second. This is what was used
on the first - as best I can tell.

Private Sub Signature_BeforeUpdate(Cancel As Integer)
Dim Response As String
Response = InputBox("Enter Password", "Password Required")
If Response <> DLookup("[Password]", "tblSignaturePasswords",
"UserName=Forms!EHSRNew!Cuser") Then
Beep
MsgBox "Incorrect Password.", vbOKOnly, "Entry Denied"
Cancel = True
Signature.Undo
End If
End Sub

and

Private Sub Form_Current()
If CUser = "Drowe" Then
Signature.Visible = False
Signature_2_.Visible = False
Signature_3_.Visible = False
Signature_5_.Visible = True
Signature_6_.Visible = False
ElseIf CUser = "John Cefola" Then
Signature.Visible = True
Signature_2_.Visible = False
Signature_3_.Visible = False
Signature_5_.Visible = False
Signature_6_.Visible = False
ElseIf CUser = "Jarod Craig" Then
Signature.Visible = False
Signature_2_.Visible = False
Signature_3_.Visible = True
Signature_5_.Visible = False
Signature_6_.Visible = False
EndIf
EndSub
 
R

Ricoy-Chicago

Is this form used in a network? if it is, then use the username as the
control, then set your restrictions in the Open-Event of the form, I have
done that because I have 10 users and each user has different restrictions on
the form.
 
R

Ricoy-Chicago

bokims said:
I want signature blocks on my form only accessible to the person who
signed
in. I have user level security so the person must sign in to have access
to
the form but beyond that I only want that person to be able to fill
his/her
name in, in their spot only to show agreement - electronic signature. I
have
this on one form but cant duplicate it on the second. This is what was
used
on the first - as best I can tell.

Private Sub Signature_BeforeUpdate(Cancel As Integer)
Dim Response As String
Response = InputBox("Enter Password", "Password Required")
If Response <> DLookup("[Password]", "tblSignaturePasswords",
"UserName=Forms!EHSRNew!Cuser") Then
Beep
MsgBox "Incorrect Password.", vbOKOnly, "Entry Denied"
Cancel = True
Signature.Undo
End If
End Sub

and

Private Sub Form_Current()
If CUser = "Drowe" Then
Signature.Visible = False
Signature_2_.Visible = False
Signature_3_.Visible = False
Signature_5_.Visible = True
Signature_6_.Visible = False
ElseIf CUser = "John Cefola" Then
Signature.Visible = True
Signature_2_.Visible = False
Signature_3_.Visible = False
Signature_5_.Visible = False
Signature_6_.Visible = False
ElseIf CUser = "Jarod Craig" Then
Signature.Visible = False
Signature_2_.Visible = False
Signature_3_.Visible = True
Signature_5_.Visible = False
Signature_6_.Visible = False
EndIf
EndSub
 
D

Douglas J. Steele

I may have mislead you. It's not necessary to put the reference to the field outside of quotes like I said it was.

Now, you appear to have posted the exact same code twice. You need to determine what's different from the new code versus the old code.

If you need more help, as I said before, simply saying that it "does not work" doesn't give me anything to go on. What does "does not work" mean? Are you getting an error message? If so, what's the error? If you're not getting an error message, what does happen, and what should happen?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I want signature blocks on my form only accessible to the person who signed
in. I have user level security so the person must sign in to have access to
the form but beyond that I only want that person to be able to fill his/her
name in, in their spot only to show agreement - electronic signature. I have
this on one form but cant duplicate it on the second. This is what was used
on the first - as best I can tell.

Private Sub Signature_BeforeUpdate(Cancel As Integer)
Dim Response As String
Response = InputBox("Enter Password", "Password Required")
If Response <> DLookup("[Password]", "tblSignaturePasswords",
"UserName=Forms!EHSRNew!Cuser") Then
Beep
MsgBox "Incorrect Password.", vbOKOnly, "Entry Denied"
Cancel = True
Signature.Undo
End If
End Sub

and

Private Sub Form_Current()
If CUser = "Drowe" Then
Signature.Visible = False
Signature_2_.Visible = False
Signature_3_.Visible = False
Signature_5_.Visible = True
Signature_6_.Visible = False
ElseIf CUser = "John Cefola" Then
Signature.Visible = True
Signature_2_.Visible = False
Signature_3_.Visible = False
Signature_5_.Visible = False
Signature_6_.Visible = False
ElseIf CUser = "Jarod Craig" Then
Signature.Visible = False
Signature_2_.Visible = False
Signature_3_.Visible = True
Signature_5_.Visible = False
Signature_6_.Visible = False
EndIf
EndSub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top