Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Canada
    Posts
    284
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problem With a Related Record Required (Access 2003)

    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.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Problem With a Related Record Required (Access 2003)

    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

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Canada
    Posts
    284
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Problem With a Related Record Required (Access 2003)

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •