getting error 2448 (you can't assign a value to this object) while setting frm.AllowEdits

M

Malcolm Cook

I'm getting error 2448 when trying to set a forms AllowEdits property in the
following function

Public Function ACForm_propogate_AllowEdits_to_subforms(frm As Access.Form,
Optional EditsImpliesDeletionAddition As Boolean = False)
'Purpose: Recursively descend through the subforms* of <frm>, "inheriting"
the property "AllowEdits", which optionally implies .AllowDeletions
' and .AllowAdditions
Dim subfrm As Access.SubForm
For Each subfrm In ACControlsOfTypes(frm.Controls, acSubform) 'which
returns a collection of all the forms subforms
subfrm.Form.AllowEdits = frm.AllowEdits 'ERROR ON THIS LINE
If EditsImpliesDeletionAddition And frm.AllowEdits Then
With subfrm.Form
.AllowDeletions = .AllowEdits
.AllowAdditions = .AllowEdits
End With
End If
ACForm_propogate_AllowEdits_to_subforms subfrm.Form,
EditsImpliesDeletionAddition
Next
End Function

This is getting called from the form's ON_CURRENT event after the form has
been loaded. The ON_CURRENT is happening while returning to the form after
applying a server filter.

Access 2002 (XP) ADP

Ideas,

Malcolm
 
M

Mingqing Cheng [MSFT]

Hi Malcolm Cook,

Thanks for your post.

From your descriptions, I understood that you would like to set subform's
AllowEdits according to its main form. Have I understood you? Correct me if
I was wrong.

Based on my scope, the AllowEdits property is considered a Form property.
Even though the Subform is a control on the Form, Access treats Subforms
differently versus other controls on the Form (e.g., ComboBox, Listbox,
etc) when using VBA to modify objects.

I am afraid you will have to use IF statement to judge whether AllowEdits
of main form is True and then set the AllowEdits directly like

subfrm.Form.AllowEdits = True or subfrm.Form.AllowEdits = False

Additionally, if this cannot resolve your issue, would you please generate
a small ADP sample (or mdb if it is available) using Northwing database. I
would like to made a reproduce, which, I believe, will make us closer and
quicker to the resolution.

Thank you for your patience and corperation. If you have any questions or
concerns, don't hesitate to let me know. We are here to be of assistance!


Sincerely yours,

Mingqing Cheng

Online Partner Support Specialist
Partner Support Group
Microsoft Global Technical Support Center
 
M

Malcolm Cook

Thanks Mingqing,

You seem to be suggesting that I need to write

if frm.AllowEdits = True then
subfrm.Form.AllowEdits = True
else
subfrm.Form.AllowEdits = False
end if


where I have written

subfrm.Form.AllowEdits = frm.AllowEdits

However the code as written works perfectly without raising the error when
called from the main forms FORM_CURRENT sub EXCEPT the one that gets raised
immediately applying a server filter. So, I just don't believe that
recoding as you suggest is going to make any difference at all.

Any other suggestions or thoughts are welcome!

--Malcolm
 
M

Mingqing Cheng [MSFT]

Hi Malcolm,

Thanks for your instant reply!

Is is possible for you to generate a small sample of the mdb file for me to
reproduce it on my side? I think I need to do further research on it.

Please send the files and descriptions directly to me:
(e-mail address removed) (please remove "online" as it is only for
SPAM, thanks)

Thank you for your patience and corperation. If you have any questions or
concerns, don't hesitate to let me know. We are here to be of assistance!


Sincerely yours,

Michael Cheng

Online Partner Support Specialist
Partner Support Group
Microsoft Global Technical Support Center
 
M

Michael Cheng [MSFT]

Hi Malcolm,

I wanted to post a quick note to see if you would like additional
assistance regarding this particular issue. We appreciate your patience and
look forward to hearing from you!

Sincerely yours,

Michael Cheng

Online Partner Support Specialist
Partner Support Group
Microsoft Global Technical Support Center
 
M

Michael Cheng [MSFT]

Hi Malcolm,

Thanks for you kindness reply letting me know it.

If you encounter any problems next time, please feel free to let us know.
We are always here to be of assistance!


Sincerely yours,

Michael Cheng

Online Partner Support Specialist
Partner Support Group
Microsoft Global Technical Support Center
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top