Maxi2011
Registered User.
- Local time
- Today, 04:47
- Joined
- Aug 6, 2004
- Messages
- 16
Hi
I am using a Select Case function change what different user levels can do on some forms where if they are case one, they can access a field on the form called [contractslink] as normal but in case two this field is disabled. [Contractlink] is a textbox field which is bound to a hyperlink field in my tables which the user can click on to open a PDF file.
Unfortunately the code doesn't seem to be working. It compiles Ok but when I try it out it doesn't enabled/disable the field as it should. The code I am using is:
Private Sub Form_Open(Cancel As Integer)
On Error Resume Next
Select Case UserName.UserPermission
Case 1
Me.ContractLink.Enabled = True
Me.AllowAdditions = True
Me.AllowDeletions = True
Me.AllowEdits = True
Case 2
Me.ContractLink.Enabled = False
Me.AllowAdditions = True
Me.AllowDeletions = False
Me.AllowEdits = True
End Select
End Sub
I have also tried using this for the On-Load property. Is this something to do with the field type I am trying to change the property for? I have changed the field name, so I am sure that it's not a case of the table and field names being the same and confusing Access and I can't see a problem with my code........but then again I am still learning VBA so there probably is somerwhere!
Any help would be apprciated. Thanks!
I am using a Select Case function change what different user levels can do on some forms where if they are case one, they can access a field on the form called [contractslink] as normal but in case two this field is disabled. [Contractlink] is a textbox field which is bound to a hyperlink field in my tables which the user can click on to open a PDF file.
Unfortunately the code doesn't seem to be working. It compiles Ok but when I try it out it doesn't enabled/disable the field as it should. The code I am using is:
Private Sub Form_Open(Cancel As Integer)
On Error Resume Next
Select Case UserName.UserPermission
Case 1
Me.ContractLink.Enabled = True
Me.AllowAdditions = True
Me.AllowDeletions = True
Me.AllowEdits = True
Case 2
Me.ContractLink.Enabled = False
Me.AllowAdditions = True
Me.AllowDeletions = False
Me.AllowEdits = True
End Select
End Sub
I have also tried using this for the On-Load property. Is this something to do with the field type I am trying to change the property for? I have changed the field name, so I am sure that it's not a case of the table and field names being the same and confusing Access and I can't see a problem with my code........but then again I am still learning VBA so there probably is somerwhere!
Any help would be apprciated. Thanks!