Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Apr 2001
    Location
    New York, New York, USA
    Posts
    170
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can't add record... (XP)

    Hello,

    I have a form with combo boxes that use table/query as their row source. The tables are related and everything is working beautifully except....

    Whenever I try to enter a new record and do not fill each of the fields, I get the "You cannot add or change a record because a related record is required in table xxx" message.

    How can I get around this? I've tried using the default value property, but that isn't working.

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

    Re: Can't add record... (XP)

    This is not enough to go on. You'll have to provide more details about the structure of your tables and the design of your query (or post a stripped down version of your database)

  3. #3
    2 Star Lounger
    Join Date
    Apr 2001
    Location
    New York, New York, USA
    Posts
    170
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can't add record... (XP)

    Hans,

    I've zipped and attached the files and stripped down the database, so when you first open it you will encounter parameter errors that are not in my original database, so don't worry about that. Simply click "OK" through each one until you get to the form.

    When you get to the form, add a new record and type only a TV station's call letters. Then add another new record and you will see the problem.

    Hans, after stripping down the database I am getting a different error message, but the behavior is the same. How can I add a new record without going through each combo box and choosing something. This must tbe possible....(I hope).

    Thanks.
    Attached Files Attached Files

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

    Re: Can't add record... (XP)

    In the table TBL_Online_Station_Info, the Default Value of the fields MktID, OwnerID, DivID and DosID is 0. So if you create a new record, each of these fields will be set to 0, but there is no corresponding record in the lookup table, hence the error message. Solution: clear the Default Value property of these four fields in the design of TBL_Online_Station_Info.

    (Unfortunately, Access always sets the default value to 0 when you create a numeric field - I hate that...)

  5. #5
    2 Star Lounger
    Join Date
    Apr 2001
    Location
    New York, New York, USA
    Posts
    170
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can't add record... (XP)

    Hans, YOU ARE THE MAN!!!! That worked and thank you. You get the points.

Posting Permissions

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