Hi
I apologise for the newbie type question. However, I am a VB not an Access programmer and the syntax for sub-forms always confuses me! (The FAQ by "SJ McAbney" did not help.)
I have an ADP project (pointing to SQL Server, if it makes any difference) and have implemented a security model based around Active Directory. I use this to set a public variable called "lngSecLevel", the higher it's value the more security the user has.
To impose the security, each form has code similar to the following in the form's open event:
If lngSecLevel = 1 Then
Me.AllowEdits = False
Me.AllowAdditions = False
Me.AllowDeletions = False
ElseIf lngSecLevel = 2 Then
Me.AllowEdits = True
Me.AllowAdditions = True
Me.AllowDeletions = False
ElseIf lngSecLevel = 3 Then
Me.AllowEdits = True
Me.AllowAdditions = True
Me.AllowDeletions = False
ElseIf lngSecLevel >= 4 Then
Me.AllowEdits = True
Me.AllowAdditions = True
Me.AllowDeletions = True
End If
(so "me" obviously is the form)
I have a sub-form "frmFile Damages sub" which is available on multiple forms (i.e. several different and distinct forms, which display the information on the "frmFile Damages sub" sub-form).
The issue is that it is possible for the same user to have different levels of security depending upon which "master" form is displayed (this is a business requirement).
As the sub-form's open event is called before the master form's open event, I cannot just place similar to the following in the sub-form's open event:
Me.AllowEdits = Me.Parent.AllowEdits
Me.AllowAdditions = Me.Parent.AllowAdditions
Me.AllowDeletions = Me.Parent.AllowDeletions
The alternative is to modify the main form's open event with the following code (but after my first snippet):
Me.[frmFile Damages sub].Form.AllowEdits = Me.AllowEdits
Me.[frmFile Damages sub].Form.AllowAdditions = Me.AllowAdditions
Me.[frmFile Damages sub].Form.AllowDeletions = Me.AllowDeletions
However, I cannot get the above to work, irrespective of the use of "!" and ".form".
Any help would be appreciated.
Marcus.
I apologise for the newbie type question. However, I am a VB not an Access programmer and the syntax for sub-forms always confuses me! (The FAQ by "SJ McAbney" did not help.)
I have an ADP project (pointing to SQL Server, if it makes any difference) and have implemented a security model based around Active Directory. I use this to set a public variable called "lngSecLevel", the higher it's value the more security the user has.
To impose the security, each form has code similar to the following in the form's open event:
If lngSecLevel = 1 Then
Me.AllowEdits = False
Me.AllowAdditions = False
Me.AllowDeletions = False
ElseIf lngSecLevel = 2 Then
Me.AllowEdits = True
Me.AllowAdditions = True
Me.AllowDeletions = False
ElseIf lngSecLevel = 3 Then
Me.AllowEdits = True
Me.AllowAdditions = True
Me.AllowDeletions = False
ElseIf lngSecLevel >= 4 Then
Me.AllowEdits = True
Me.AllowAdditions = True
Me.AllowDeletions = True
End If
(so "me" obviously is the form)
I have a sub-form "frmFile Damages sub" which is available on multiple forms (i.e. several different and distinct forms, which display the information on the "frmFile Damages sub" sub-form).
The issue is that it is possible for the same user to have different levels of security depending upon which "master" form is displayed (this is a business requirement).
As the sub-form's open event is called before the master form's open event, I cannot just place similar to the following in the sub-form's open event:
Me.AllowEdits = Me.Parent.AllowEdits
Me.AllowAdditions = Me.Parent.AllowAdditions
Me.AllowDeletions = Me.Parent.AllowDeletions
The alternative is to modify the main form's open event with the following code (but after my first snippet):
Me.[frmFile Damages sub].Form.AllowEdits = Me.AllowEdits
Me.[frmFile Damages sub].Form.AllowAdditions = Me.AllowAdditions
Me.[frmFile Damages sub].Form.AllowDeletions = Me.AllowDeletions
However, I cannot get the above to work, irrespective of the use of "!" and ".form".
Any help would be appreciated.
Marcus.