You Can't Assign Value to This Object (Subform)

Reichel

New member
Local time
Tomorrow, 01:04
Joined
Nov 5, 2017
Messages
6
I am having an issue with a subform where the first time I click to add a new record I get this error "You Can't Assign Value to This Object". The error doesn't actually cause any problems, and if I click through it, the records adds with no problem.

My database has three tables,
-full employees list: it has data of the all employees in the organization
-Succession plans info: has the information of the succession plan, no information gets updated here, it just for viewing and refrence
- employee on plans: has a list of employees in each plan and their readiness for that role. this is the main table that need to be updated and the form in question allows the user to view people on a plan and either retain or remove them, and add new employees, and finally review suggested employees for the plan. one employee can be on many plan and not all employees need to be on a plan.
 

Attachments

see if this is what you want.
you need to create three subforms. a single subform used as 3 subform with different Link Master/Child Fields will not work.
 

Attachments

see if this is what you want.
you need to create three subforms. a single subform used as 3 subform with different Link Master/Child Fields will not work.

Unfortunately this does not solve my problem, because I need the user to be able to add employees to the "employees on plan" table from within the form.

I dont think the multiple subform containers with one source subform is the problem, I deleted all of them and kept one only, but I still got the error message when adding new record.

Please post the code for the onclick event of the button

The refresh data button is just a requery
 
the error pops up once you start typing in a new record.

this is the full text of the error msg:
You can't assign a value to this object.
*The object may be a control on a read-only form.
*The object may be on a form that is open in Design View
*The value may be too large for this field.

there is a 2013 post that describes my issue exactly but I dont understand the solution the original poster suggests:
Thought I would share a little discovery I have made after some have-duty wall climbing. You will find dozens of Access forum entries dealing with the above Access message (Runtime Error 2448) and a good portion of those deal with the specific issue of it appearing when starting data entry in subforms. The message says :

You can't assign a value to this object.
*The object may be a control on a read-only form.
*The object may be on a form that is open in Design View
*The value may be too large for this field.

But in reality, once you clear the message (which pops after the first letter was entered), shaking your head because none of the above applies, you are allowed to continue and the record is saved without further complaints or ceremonies and it links correctly and can be edited on further visits.

I have decided to redo my memo fields in one of my databases and place them all in one separate table. The memos are then attached as subforms. I created a pointer field in each of the tables as a master field to link by with a subform. On a couple of occasions prior, I created such a field to easily sort by a unique composite key. Never had any problems using it with subforms. However, in this particuar instance it started to give me this silly message. I say 'silly' because it is transient and says something that is not true. Evidently, you can assign value to this object (in this particular scenario).

First I thought it had to do with the rich text fomat that I have in the Memos (the RTF does not work in Access 2007 subforms but that's another story). But it didn't. So I tried other things and they did not work. Always the same thing. After the first letter typed the message popped up.

I hope I found the solution to this particular form of the 2448 RTE. On one of the boards someone was saying that the master field has to the PK of the main form. I knew that was baloney because I have a number of forms where I use another (unique) key for the master-child coupling with no trouble at all. But then I realized what might be happening. The autonumber of the master form would be supplied early by the Jet/Ace engine and so is available to the before the sub is entered. One can start writing into the sub fields right away and switch to the main form with the record being saved because the link has already been established by the engine coupling. That would not be ....duh.! :rolleyes:... the case when I am supplying the value myself. So it looks like the value of the master - child fields has to be known to both forms before the first stroke hits the subform. Does that make sense ? If it does, then

perhaps a fourth line should be on the Access message saying:

* The object may be on a subform with a Null in the linked Master Field

Hopefully, this info will be of some value to people on this Board. Initializing the subform with the linking key solved the problem for me. At any rate, let me know your thoughts!

Best,
Jiri
 
here this is a wild guess, i was thinking you have 3 subform using only one, but its actually 4. try which one subform do you want to add.
 

Attachments

The problem was that one of the link child fields was a calculated field (IIf([Status]="Remove","Remove",IIf([Status]="Incumbent","Inc",IIf([Status]="Suggest","Suggest","Keep")))) which doesn't calculate until you start typing into the new record, hence the error.

I deleted the calculated field and added a small reference table, and that solved the problem
 
The problem was that one of the link child fields was a calculated field (IIf([Status]="Remove","Remove",IIf([Status]="Incumbent","Inc",IIf([Status]="Suggest","Suggest","Keep")))) which doesn't calculate until you start typing into the new record, hence the error.

I deleted the calculated field and added a small reference table, and that solved the problem

Actually, you don't need to add anything. Just removing the second pair from Master-Child relationship will do the trick.

Best,
Jiri
 
Jiri,

Could you make the change(s) to the database supplied Reichel in post#1 to illustrate your solution. Seems it has been a problem for some time, and it would be good for many if there was a database A with the problem and a database B or details of exactly how the problem is resolved with a "solved database".

Thanks, and I am glad you have it resolved.
 
Jiri,

Could you make the change(s) to the database supplied Reichel in post#1 to illustrate your solution. Seems it has been a problem for some time, and it would be good for many if there was a database A with the problem and a database B or details of exactly how the problem is resolved with a "solved database".

Thanks, and I am glad you have it resolved.

Here you go.

Cheers,
Jiri
 

Attachments

Users who are viewing this thread

Back
Top Bottom