J
jsteeves
I need to open a form in "read only" - it contains many subforms placed
within tab controls:
/begin diagram
Forms![Master]
Forms![Master]![frmA]
Forms![Master]![frmB]
Forms![Master]![frmB].Form![frmB1]
Forms![Master]![frmB].Form![frmB2]
/end diagram
frmA and frmB are in a tabctl in Master
frmB1 and frmB2 are in a tabctl in frmB
i need to loop thru all the forms to set the read only properties, here is
what i have:
On Error Resume Next
Dim stLinkCriteria As String
Dim frMaster As form
Dim Ctrl As Control
Dim CCtrl As Control
Set frMaster = Form_Master
stLinkCriteria = "fieldA=""" & lstControl & "" 'setting a filter
frMaster.Filter = stLinkCriteria
With frMaster
.AllowAdditions = False
.AllowDeletions = False
.AllowEdits = False
.Visible = True
End With
For Each Ctrl In frMaster
If Ctrl.ControlType = acTabCtl Then
For Each CCtrl In Ctrl
If CCtrl.ControlType = acSubform Then
With CCtrl
.AllowAdditions = False
.AllowDeletions = False
.AllowEdits = False
End With
End If
Next CCtrl
End If
Next Ctrl
End Sub
I have tried without testing for tabcontrol and just testing for subform and
get pretty much the same result. It appears to be locating the subforms and
going through the with block, but not actually applying any of the properties.
within tab controls:
/begin diagram
Forms![Master]
Forms![Master]![frmA]
Forms![Master]![frmB]
Forms![Master]![frmB].Form![frmB1]
Forms![Master]![frmB].Form![frmB2]
/end diagram
frmA and frmB are in a tabctl in Master
frmB1 and frmB2 are in a tabctl in frmB
i need to loop thru all the forms to set the read only properties, here is
what i have:
On Error Resume Next
Dim stLinkCriteria As String
Dim frMaster As form
Dim Ctrl As Control
Dim CCtrl As Control
Set frMaster = Form_Master
stLinkCriteria = "fieldA=""" & lstControl & "" 'setting a filter
frMaster.Filter = stLinkCriteria
With frMaster
.AllowAdditions = False
.AllowDeletions = False
.AllowEdits = False
.Visible = True
End With
For Each Ctrl In frMaster
If Ctrl.ControlType = acTabCtl Then
For Each CCtrl In Ctrl
If CCtrl.ControlType = acSubform Then
With CCtrl
.AllowAdditions = False
.AllowDeletions = False
.AllowEdits = False
End With
End If
Next CCtrl
End If
Next Ctrl
End Sub
I have tried without testing for tabcontrol and just testing for subform and
get pretty much the same result. It appears to be locating the subforms and
going through the with block, but not actually applying any of the properties.