• Problem With a Related Record Required (Access 2003)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Problem With a Related Record Required (Access 2003)

    Author
    Topic
    #422192

    I’ve made up a database where you can record websites and their URLs, categorize the websites, then pick several topics under each website with your opinion on them and rating. The problem that I’m having is that when I type in the website and URL then try to pick the Category, I get “You cannot add or change a record because a related record is required in tblCategory.” Why is this?

    My tblSite consists of: SiteNumber, SiteName, SiteURL, CategoryNumber. And my tblCategory consists of: CategoryNumber, CategoryName, CategoryDefinition. I have a relationship set up of one-to-many (tblCategory being the One, and tblSite being the Many). Is this incorrect?

    I’ve attached an example of my database just in case.

    Viewing 0 reply threads
    Author
    Replies
    • #961934

      There are several problems:
      – You haven’t included CategoryNumber in the Record Source of frmSite, so it is impossible to specify a Category for a site.
      – The Default Value for CategoryNumber is 0. As a result, CategoryNumber will be 0 in a newly created record, but that doesn’t correspond to a record in tblCategory, hence the error message.

      To remedy this:
      – Clear the Default Value property of CategoryNumber in tblSite.
      – Set the Record Source of frmSite to tblSite.
      – Set the Control Source of cmbCategory on frmSite to CategoryNumber.
      – Select View | Tab Order and move cmbCategory up to before the subform.

      See attached version

      • #961957

        Okay, now that I’ve made those corrections you suggested my database is running tickety-boo. Thanks, Hans.

    Viewing 0 reply threads
    Reply To: Problem With a Related Record Required (Access 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: