Re: Duplicate values prevent adding new records



The error message has to do with the value of the key field of the new
record, it is the same as one that is already there. From your last comment
it sounds that your table design is bad. If it is possible that two records
can have the same value in a field, that field cannot be a primary key. If
it is all the fields can be duplicated then it means that you don't really
need a primary key - they can be indexed but not primary. If you still want
a primary key you can add a new field called say, ID, and make it autonumber
which will always be unique.
Brian

"Kevin" <Kevin@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:4287233D-5C7B-474A-849A-0EFB0E2DA202@xxxxxxxxxxxxxxxx
Hi all,

I have a form which displays summarized information on Mission Reports in
a
number of textboxes. The textboxes are locked. In order to edit the
information for a given report, I have created another form (for editing
and
adding new records)with identical textboxes which is opened by a command
button. when I click on the new record button and attempt to add new
information for a second Mission report and then close the form, I get a
message saying: "The changes you requested to the table were not
successful
because they would create duplicate values in the index, primary key or
relationship..."
My main form and my form for editing display information according to
country. Both have the same underlying table (Table 1) where countries and
their country codes are listed alphabetically. The primary key is
"country".
The two forms are filtered.
My question is what do i need to do to be able to add new records in the
Edit form without creating duplicate values? I have attempted changing the
primary key in Table 1 to code or region for example but to no effect.

Would appreciate any help.



.



Relevant Pages

  • Re: MFC/ODBC/ACCESS Creating a New DataRecord in a table with primary key
    ... The error message is quite informative - it is telling you that you have ... > I have a table with an auto number field as primary key. ... > eate duplicate values in the index, primary key, or relationship. ... > Is there any possibility to get the new key from the database instead of ...
    (microsoft.public.vc.mfc)
  • Re: Completed subform Question
    ... the error message is not telling you the record already exists. ... and that is violating a primary key or unique-index rule. ... started this morning at 8:13 am, titled "Subform control", and read the ... >>date to the parent table, ...
    (microsoft.public.access.forms)
  • Re: removing last chrs (with different browsers giving different last chrs )
    ... I normally stick to regexp even if is_numericor type casting would also suffice, since the regexp engine is needed anyway, and I've set up a collection of frequently needed expressions as class constants. ... could very well be a primary key. ... In this case foreign key integrity would be violated (after all we are using a "real" relational database engine, ... A detailled error message is precisely the wrong thing in this case - it won't help the user, the developer has his or her own sources, but the evil bot will feast on that. ...
    (comp.lang.php)
  • Re: Median and Quartiles - Speeding Up The Calculations
    ... I'm getting the following error message: ... Query 2 is named qry Quartiles_Sub_Interpolation ... DataEffectiveDate - Primary Key ...
    (microsoft.public.access.modulesdaovba)
  • Re: Delete a row from Excel via ADO.NET
    ... I have a primary key. ... But I got the following error message: "Deleting data ... the sheet (you could try and do a field by field match, ...
    (microsoft.public.dotnet.languages.csharp)