'You cannot assign a value to this object'

Posted on 2008-11-19
Last Modified: 2012-06-27
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.
Question by:barnett100
    LVL 84

    Accepted Solution

    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.

    Author Comment

    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
    LVL 84
    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
    My experience with Windows 10 over a one year period and suggestions for smooth operation
    With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
    The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now