K
Kate
I originally posted this on the Access conversion
newsgroup, but the response was so minimal, I
thought this would perhaps be a better place to post.
I have a fully-qualified reference in VBA to a
subform of a subform of a form, which works fine
in Access 2003.
In Access 2007, however, it results in "you have
entered an invalid
reference to the property Form/Report."
This is the snippet of code:
Private Sub SetFormProperties()
'called from form_open, makes all forms editable
if edit mode was selected
Dim ctrl As Control, ctrlSub As Control
Dim frm As Form
If Me.OpenArgs = "Edit" Then
Set frm = Me
'set main form edit options
EditProperties frm
'set subform edit options
For Each ctrl In frm
If ctrl.ControlType = acSubform Then
EditProperties
Forms(frm.Name).Controls(ctrl.Name).Form
For Each ctrlSub In ctrl.Form
'subforms can have subforms!
If ctrlSub.ControlType =
acSubform Then
EditProperties
Forms(frm.Name).Controls(ctrl.Name).Form.Controls(ctrlSub.Name).Form
'
THIS IS THE LINE THAT CAUSES THE ERROR!!
End If
Next ctrlSub
End If
Next ctrl
End If
End Sub
Sub EditProperties(frm As Form)
'this only gets called when Edit mode is true, as
forms are opened
read-only otherwise.
With frm
.AllowAdditions = True
.AllowEdits = True
.AllowDeletions = True
End With
End Sub
Thanks if you can help me,
Kate
newsgroup, but the response was so minimal, I
thought this would perhaps be a better place to post.
I have a fully-qualified reference in VBA to a
subform of a subform of a form, which works fine
in Access 2003.
In Access 2007, however, it results in "you have
entered an invalid
reference to the property Form/Report."
This is the snippet of code:
Private Sub SetFormProperties()
'called from form_open, makes all forms editable
if edit mode was selected
Dim ctrl As Control, ctrlSub As Control
Dim frm As Form
If Me.OpenArgs = "Edit" Then
Set frm = Me
'set main form edit options
EditProperties frm
'set subform edit options
For Each ctrl In frm
If ctrl.ControlType = acSubform Then
EditProperties
Forms(frm.Name).Controls(ctrl.Name).Form
For Each ctrlSub In ctrl.Form
'subforms can have subforms!
If ctrlSub.ControlType =
acSubform Then
EditProperties
Forms(frm.Name).Controls(ctrl.Name).Form.Controls(ctrlSub.Name).Form
'
THIS IS THE LINE THAT CAUSES THE ERROR!!
End If
Next ctrlSub
End If
Next ctrl
End If
End Sub
Sub EditProperties(frm As Form)
'this only gets called when Edit mode is true, as
forms are opened
read-only otherwise.
With frm
.AllowAdditions = True
.AllowEdits = True
.AllowDeletions = True
End With
End Sub
Thanks if you can help me,
Kate