locked
Append query - key violations RRS feed

  • Question

  • Hi

    Having this expression in an append query:

    “Expr1: ([Forms]![Inleverans]![insatsID])”

    Giving a ”D” but I need a Long Integer

    Naturally it gives me " didnt add 15 records to the table due to key violations..."

    Changed the expression to:

    Expr1: CLng([Forms]![Inleverans]![insatsID])

    Giving a ”68” - which in this case is the right ID but still I get the same message.

    What am I doing wrong?


    Cheers // Peter Forss Stockholm

    Monday, September 14, 2020 2:44 PM

All replies

  • I don't see how CLng would convert "D" to 68 - are you sure you didn't use Asc instead?

    And if the value is appended to a field with a unique index: are you certain that your expression doesn't produce duplicate values?


    Regards, Hans Vogelaar (https://www.eileenslounge.com)

    Monday, September 14, 2020 2:56 PM
  • the key violation error will fire if you append into a table that has an autonumber key field - - and the append query includes that field...   delete that field from the query so that the table's autonumber will provide the value

    so it may not be related to the field you describe; by the way I have confusion on your description of it...

    Wednesday, September 16, 2020 1:52 AM