Discussion:
2003 code raises error in 2007
(too old to reply)
Kate
2009-09-24 21:57:58 UTC
Permalink
I have a reference in VBA to a subform of a subform, 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
AccessVandal via AccessMonster.com
2009-09-25 07:00:58 UTC
Permalink
Might be one of those quirks in 2007. Looks like references problem although
you might not have any missing references.

If compact and repair and recompiling your code did not work.

Here what we can do at least.

Go to Tools – References

Record down all the references you have. Delete all references and click OK
and exit the database.

Reopen your DB again, re-select your references again and exit your DB.

Open your DB again and test.

See if that works for you.

If it still doesn’t, do a decompile here a site on this.

http://www.granite.ab.ca/access/decompile.htm

Note: Do a back of your database first.
Post by Kate
I have a reference in VBA to a subform of a subform, which works fine in
Access 2003.
In Access 2007, however, it results in "you have entered an invalid
reference to the property Form/Report."
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
--
Please Rate the posting if helps you.

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-conversion/200909/1
Kate
2009-09-25 15:20:57 UTC
Permalink
Thanks for the reply, but I think you misunderstand the problem. It is
the fully-qualified reference to the
form that is the problem, not a missing VBA reference.
Post by AccessVandal via AccessMonster.com
Might be one of those quirks in 2007. Looks like references problem although
you might not have any missing references.
If compact and repair and recompiling your code did not work.
Here what we can do at least.
Go to Tools – References
Record down all the references you have. Delete all references and click OK
and exit the database.
Reopen your DB again, re-select your references again and exit your DB.
Open your DB again and test.
See if that works for you.
If it still doesn’t, do a decompile here a site on this.
http://www.granite.ab.ca/access/decompile.htm
Note: Do a back of your database first.
Post by Kate
I have a reference in VBA to a subform of a subform, which works fine in
Access 2003.
In Access 2007, however, it results in "you have entered an invalid
reference to the property Form/Report."
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
AccessVandal via AccessMonster.com
2009-09-26 05:31:50 UTC
Permalink
Nonetheless, you might consider it. It a worthwhile try to get your DB
working.
Post by Kate
Thanks for the reply, but I think you misunderstand the problem. It is
the fully-qualified reference to the
form that is the problem, not a missing VBA reference.
--
Please Rate the posting if helps you.

Message posted via http://www.accessmonster.com
Kate
2009-09-28 13:16:08 UTC
Permalink
I did implement all of those suggestions, with no change in the error.
Post by AccessVandal via AccessMonster.com
Nonetheless, you might consider it. It a worthwhile try to get your DB
working.
Post by Kate
Thanks for the reply, but I think you misunderstand the problem. It is
the fully-qualified reference to the
form that is the problem, not a missing VBA reference.
AccessVandal via AccessMonster.com
2009-09-29 01:44:58 UTC
Permalink
Kate, refer to your other thread on my reply.
Post by Kate
I did implement all of those suggestions, with no change in the error.
--
Please Rate the posting if helps you.

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-conversion/200909/1
unknown
2009-10-10 13:39:35 UTC
Permalink
Post by AccessVandal via AccessMonster.com
Kate, refer to your other thread on my reply.
Post by Kate
I did implement all of those suggestions, with no change in the error.
--
Please Rate the posting if helps you.
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-conversion/200909/1
unknown
2009-10-10 13:39:22 UTC
Permalink
Post by Kate
I did implement all of those suggestions, with no change in the error.
Post by AccessVandal via AccessMonster.com
Nonetheless, you might consider it. It a worthwhile try to get your DB
working.
Post by Kate
Thanks for the reply, but I think you misunderstand the problem. It is
the fully-qualified reference to the
form that is the problem, not a missing VBA reference.
unknown
2009-10-10 13:39:26 UTC
Permalink
Post by AccessVandal via AccessMonster.com
Nonetheless, you might consider it. It a worthwhile try to get your DB
working.
Post by Kate
Thanks for the reply, but I think you misunderstand the problem. It is
the fully-qualified reference to the
form that is the problem, not a missing VBA reference.
--
Please Rate the posting if helps you.
Message posted via http://www.accessmonster.com
unknown
2009-10-10 13:39:30 UTC
Permalink
Thanks for the reply, but I think you misunderstand the problem. It is the
fully-qualified reference to the
form that is the problem, not a missing VBA reference.
Post by AccessVandal via AccessMonster.com
Might be one of those quirks in 2007. Looks like references problem although
you might not have any missing references.
If compact and repair and recompiling your code did not work.
Here what we can do at least.
Go to Tools – References
Record down all the references you have. Delete all references and click OK
and exit the database.
Reopen your DB again, re-select your references again and exit your DB.
Open your DB again and test.
See if that works for you.
If it still doesn’t, do a decompile here a site on this.
http://www.granite.ab.ca/access/decompile.htm
Note: Do a back of your database first.
Post by Kate
I have a reference in VBA to a subform of a subform, which works fine in
Access 2003.
In Access 2007, however, it results in "you have entered an invalid
reference to the property Form/Report."
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
unknown
2009-10-10 13:33:48 UTC
Permalink
Post by AccessVandal via AccessMonster.com
Might be one of those quirks in 2007. Looks like references problem although
you might not have any missing references.
If compact and repair and recompiling your code did not work.
Here what we can do at least.
Go to Tools - References
Record down all the references you have. Delete all references and click OK
and exit the database.
Reopen your DB again, re-select your references again and exit your DB.
Open your DB again and test.
See if that works for you.
If it still doesn't, do a decompile here a site on this.
http://www.granite.ab.ca/access/decompile.htm
Note: Do a back of your database first.
Post by Kate
I have a reference in VBA to a subform of a subform, which works fine in
Access 2003.
In Access 2007, however, it results in "you have entered an invalid
reference to the property Form/Report."
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
--
Please Rate the posting if helps you.
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-conversion/200909/1
unknown
2009-10-10 13:39:41 UTC
Permalink
Post by AccessVandal via AccessMonster.com
Might be one of those quirks in 2007. Looks like references problem although
you might not have any missing references.
If compact and repair and recompiling your code did not work.
Here what we can do at least.
Go to Tools - References
Record down all the references you have. Delete all references and click OK
and exit the database.
Reopen your DB again, re-select your references again and exit your DB.
Open your DB again and test.
See if that works for you.
If it still doesn't, do a decompile here a site on this.
http://www.granite.ab.ca/access/decompile.htm
Note: Do a back of your database first.
Post by Kate
I have a reference in VBA to a subform of a subform, which works fine in
Access 2003.
In Access 2007, however, it results in "you have entered an invalid
reference to the property Form/Report."
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
--
Please Rate the posting if helps you.
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-conversion/200909/1
unknown
2009-10-10 13:36:46 UTC
Permalink
Post by AccessVandal via AccessMonster.com
Might be one of those quirks in 2007. Looks like references problem although
you might not have any missing references.
If compact and repair and recompiling your code did not work.
Here what we can do at least.
Go to Tools - References
Record down all the references you have. Delete all references and click OK
and exit the database.
Reopen your DB again, re-select your references again and exit your DB.
Open your DB again and test.
See if that works for you.
If it still doesn't, do a decompile here a site on this.
http://www.granite.ab.ca/access/decompile.htm
Note: Do a back of your database first.
Post by Kate
I have a reference in VBA to a subform of a subform, which works fine in
Access 2003.
In Access 2007, however, it results in "you have entered an invalid
reference to the property Form/Report."
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
--
Please Rate the posting if helps you.
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-conversion/200909/1
Continue reading on narkive:
Loading...