Run-time error '2448'

nakamichie

Registered User.
Local time
Today, 01:57
Joined
Apr 8, 2015
Messages
16
Hello,

I was doing fine on my form creation but now I am getting the error message of runt time error 2448.

It worked totally fine on another form but now on a new form it is no longer working and giving me this error. What I am trying to do is after a Combobox is changed and if a specific record is picked it will update a combobox on a subform that is child linked to the main form. But this error shows up each time I change the main form combo box:

Private Sub IllnessID_AfterUpdate()

If Me.IllnessID.Column(1) Like "*Cancer*" Then
Me.EmployeeSubform.Form!Priority.Value = "A - Urgent"
Me.ISO = 0

ElseIf Me.IllnessID = 51 Or Me.IllnessID = 52 Or Me.IllnessID = 120 Or Me.IllnessID = 126 Or Me.IllnessID = 84 Then

Me.ISO = -1
Me.EmployeeSubform.Form!Priority.Value = "C - Medical Lines, Low"

Else
Me.EmployeeSubform.Form!Priority.Value = "C - Medical Lines, Low"
Me.ISO = 0


End If




I have searched around and changed my Me. to a Me! or used the full path but nothing fixes it. Any help would be great. I am a newbie here. Thanks.
 
What is the error message?
What is the name of the combobox in the subform?
 
The error message is run time error "2448" and highlights the following text:

Me.EmployeeSubform.Form!Priority.Value = "A - Urgent" or any of the ones like this when the combo box on main form (ILLNESSID) selects one of those.

The combo box on the subform is [Priority]

Thanks
 
The error message is run time error "2448"
No - that is the error number, it must be some text message also.
Do you've set the field in the table to a lookup field?
Post a stripped version of your database with some sample data, zip it!
 
? error(2448)
Application-defined or object-defined error

Is EmployeeSubform the name of the saved form being used as the subform and not the name of the subform control in the parent form?

Check the name of the subform control in the Properties window.
 
Okay the error message I am getting is

"runtime error you can’t assign a value to this object."

Yes I have made sure the control name is the one I am referencing and have even changed all the control names for the the subform combobox [Priority] to another control box name as well as the main form combobox and have changed the name to the subform itself. This did not fix the problem. I also changed the Me. to a Me! and the whole pathname to the full forms!.... this didn't work either.

I have uploaded a stripped down version of my database with the problem I am having. What is weird is I have one form I created that is almost similar and it works with the combobox after update linked to the same subform, etc. I just can't get this other one to work without the errors.

Any help would be great.

Thanks.
 

Attachments

If I were to open the form, what are the steps I would follow to cause the error to occur?
 
"you can't assign a value to this object" is generic in a way, though it is clear enough. Stepping back from the form, in essence this error says that you have named an object for which the value you tried to set cannot be set. For instance, if the form has "AllowEdits" set to FALSE and you try to edit the contents of a control on that form, you get that exact error. I've gotten it many times, always because we so often forget that forms have states just like controls have states. If the control is not enabled (or is it locked? I forget which at the moment), you might see that error.

Set a breakpoint in your code to the area where you get the error, then open the Locals window. You should be able to find the states of the various properties on the forms and controls by drilling down a bit. Either the form is disallowing changes or the control is doing it - which is also why it does it for one form but not another one.
 
you have named an object for which the value you tried to set cannot be set.
True

For instance, if the form has "AllowEdits" set to FALSE and you try to edit the contents of a control on that form, you get that exact error.
False, not in code. Did you try it?

If the control is not enabled (or is it locked? I forget which at the moment), you might see that error.
False, not in code. Did you try it?

The object is not changeable by code or by other means if the object's control source has already been set to a calculation or reference - anything but a recordsource field name. See if you in the control source property of your object have anything beginning with "="
 
The problem is you've set a record lock on the main form.
 
Thanks for all your answers. On JHB's response do you mean the section under DATA on "Record Locks" being set to "edited Record" instead of "Unlocked Record"? I don't quite understand all the differences between these.

I have fixed the form another way but would like to get this figured out.

Thanks.
 
Give your subform controls distinct names from the subform itself. So if the form embedded in the subform control is called EmployeesSubform, don't call the subform control EmployeesSubform, call it sbfEmployeesSubform or something along those lines.
 

Users who are viewing this thread

Back
Top Bottom