"You can't assign a value to this object" Error Message (1 Viewer)

Student2014

Registered User.
Local time
Today, 01:01
Joined
Dec 3, 2014
Messages
6
Hello,

I'm building a simple database for storing records about books.

I'm currently working on one of the data entry forms. Part of this form is supposed to enable the user to add details about the book and the series that it belongs to (if it does belong to one).

The relationship is One-to-Many: One series can have many books. I've made the series part a sub form.

When I enter some data to test that it works, I get an error message when I try to add a new series using the sub form. It 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."

As far as I know there isn't anything wrong, so I'm not certain why this error message comes up. I think it may have something to do with the primary key being the AutoNumber data type, but I just click 'OK' and ignore it, and it works fine.

The database works as far as I can see, I just want the error message to stop appearing. It's not very user friendly and can get very annoying. Any ideas?

I've attached the database to this post. Sorry the form is so messy, I've not designed it properly yet because I'm just trying to make it work first.

Thank you in advance :)
 

Attachments

  • BookJournalv2.1.accdb
    1.3 MB · Views: 204

llkhoutx

Registered User.
Local time
Yesterday, 19:01
Joined
Feb 26, 2001
Messages
4,018
For starters, verify that the data type of the control being stored and the control being stored into are of compatible data types.
 

Student2014

Registered User.
Local time
Today, 01:01
Joined
Dec 3, 2014
Messages
6
Thank you for your reply.

The primary key is AutoNumber and the foreign key is Number with the Long Integer type. I think those two data types are compatible?
 

llkhoutx

Registered User.
Local time
Yesterday, 19:01
Joined
Feb 26, 2001
Messages
4,018
I can't tel how you're making a update/append, but you cannot store over an autonumber.
 

Student2014

Registered User.
Local time
Today, 01:01
Joined
Dec 3, 2014
Messages
6
I can't tel how you're making a update/append, but you cannot store over an autonumber.

Book ID is a foreign key is tblSeries. tblSeries is a sub form in a form containing the fields from tblBook.

On the Office website it says "Use the Long Integer data type when you create a foreign key to relate a field to another table's AutoNumber primary key field" support.office.com/en-us/article/Field-properties-quick-reference-2d1ed3b6-c332-4f66-9cb3-be4690bf06c1

It does seem to work, but the error message pops up when you go to enter a new series record in the sub form. When I close and ignore the error message it works anyway. I'm just hoping to find away of stopping the error message from popping up.
 

JHB

Have been here a while
Local time
Today, 02:01
Joined
Jun 17, 2012
Messages
7,732
The problem is the you've turn it on the head!
So the main form is the Series and the subform is the details and it is not how you've it!
Sorry but it doesn't work even if you claim something else, (look in your table the information is getting in)!
 

Users who are viewing this thread

Top Bottom