Hi All,
I have a form which is used on its own standalone and is also used as a subform. I want to make it read only when opened as a standalone.
It’s opened from a command button using
DoCmd.OpenForm "frm Vendors Secondary", acNormal, , "[EquipmentIDFK]=" & EquipmentID, , acFormReadOnly, Me![VendorEquipmentJCTID]
When it’s used as a subform there is other code in the form OnLoad event which looks at user permissions and allows edits if the user has sufficient rights, so appears to be overriding the acFormReadOnly.
I would like to insert a test for the form opened as a parent or subform into the code below, but have searched and not found anything?
Private Sub Form_Load()
On Error GoTo Err_Form_Load
Dim iEdit As Integer
'set edit permissions
iEdit = Forms!frmmenu!txtLevel.Value
Select Case iEdit
Case Is < 2
Me.AllowEdits = False
Case Else
Me.AllowEdits = True
End Select
Any suggestions welcome.
Thanks
Mark.
I have a form which is used on its own standalone and is also used as a subform. I want to make it read only when opened as a standalone.
It’s opened from a command button using
DoCmd.OpenForm "frm Vendors Secondary", acNormal, , "[EquipmentIDFK]=" & EquipmentID, , acFormReadOnly, Me![VendorEquipmentJCTID]
When it’s used as a subform there is other code in the form OnLoad event which looks at user permissions and allows edits if the user has sufficient rights, so appears to be overriding the acFormReadOnly.
I would like to insert a test for the form opened as a parent or subform into the code below, but have searched and not found anything?
Private Sub Form_Load()
On Error GoTo Err_Form_Load
Dim iEdit As Integer
'set edit permissions
iEdit = Forms!frmmenu!txtLevel.Value
Select Case iEdit
Case Is < 2
Me.AllowEdits = False
Case Else
Me.AllowEdits = True
End Select
Any suggestions welcome.
Thanks
Mark.
Last edited: