• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 352
  • Last Modified:

'You cannot assign a value to this object'

Hello. I get the above message when I try to enter data into a sub form. The main form 'Referral' is based on a table with the same name and the subform 'youngperson' is also based on a table with that name. the relationship of young person to referral is one to many.If i enter some data into the referral table first and then try to enter data into the subform , i get the message 'you cannot add or change ....because a related record is required in young person'
What am I doing wrong ?
Thanks in advance.
0
barnett100
Asked:
barnett100
  • 2
1 Solution
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Are your tables properly related? The "youngperson" table should store the ID value of the "referral" table. The error sounds like you've got a relationship problem, since your youngperson table shouldn't depend on itself.

Are your Master/Child links set correctly for the subform? The error is just Access telling you that you're trying to enter an orphaned record, and typically this comes about when those links aren't set correctly. Your Master link would be the ID of the Referral table, and your Child link would be the field in "youngperson" where you store the value of Referral.ID.
0
 
barnett100Author Commented:
Thanks. Im sure you are right. I thought that in a one to many relationship the pk of the one ended up as the fk of the many., thus creating the link. Ive obviously got a bit mixed upi and will try reorganising my relationships. Thanks
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
It does ... if your Referrals is the "one" and the YoungPerson is the "Many", you'd store the value of Referrals.IDField in YoungPerson.YourForeignKeyField
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now