Hello.
I have a procedure that collects control names from a subform into a CSV string.
I have been using procedures like this for years without any problems.
Suddenly I start getting Run-time error '2455':
"You entered an expression that has an invalid reference to the property Form/Report."
I have setup a subform object and a control object.
Dim iSubForm as SubForm
Dim Ctrl as Control
I use a constant for the subform name.
Const SFName as String = "sfrmSelectRecord"
The subform is instantiated and it's name is printed.
Set iSubForm = Forms(0).Controls(SFName)
Debug.Print iSubForm.Name
The statement that generates Error '2455' is:
For Each Ctrl In iSubForm.Controls
Debug.Print Ctrl.Name
Next
The subform object is terminated when the loop finishes.
set iSubForm = Nothing
I have tried replacing the For Each statement with:
For Each Ctrl In iSubForm.Form.Controls
The same error is raised.
I am hoping to find a solution to this short of deleting and reinstalling Office!
I suspect a Microsoft Update is causing the problem, but have no evidence.
Any help would be appreciated!
Thank you.
I have a procedure that collects control names from a subform into a CSV string.
I have been using procedures like this for years without any problems.
Suddenly I start getting Run-time error '2455':
"You entered an expression that has an invalid reference to the property Form/Report."
I have setup a subform object and a control object.
Dim iSubForm as SubForm
Dim Ctrl as Control
I use a constant for the subform name.
Const SFName as String = "sfrmSelectRecord"
The subform is instantiated and it's name is printed.
Set iSubForm = Forms(0).Controls(SFName)
Debug.Print iSubForm.Name
The statement that generates Error '2455' is:
For Each Ctrl In iSubForm.Controls
Debug.Print Ctrl.Name
Next
The subform object is terminated when the loop finishes.
set iSubForm = Nothing
I have tried replacing the For Each statement with:
For Each Ctrl In iSubForm.Form.Controls
The same error is raised.
I am hoping to find a solution to this short of deleting and reinstalling Office!
I suspect a Microsoft Update is causing the problem, but have no evidence.
Any help would be appreciated!
Thank you.