Link to home
Create AccountLog in
Avatar of pdvsa
pdvsaFlag for United States of America

asked on

Append Query - key violation

Experts,

I have narrowed down an error in my append query (pic attached)
The error is associated with this column (pic attached):
LCType: Switch([Nature] Like "PB*",22,[Nature] Like "APB*",25,[Nature] Like "PC*",18,[Nature] Like "Misc*",19,[Nature] Like "Surety*",42,[Nature] Like "BB*",23,[Nature] Like "HP*",43,True,"")

If I delete the column then it Appends with no issues and no errors and therefore I believe the issue is with this column only.  

The numbers in the SWITCH correspond to LC names (in tbLCTypeDropBox) such as for example:
22 = SB - Performance LC and so on for the remaining numbers

tblLetterOfCredit.LCType is a combo box with this as the row source:
SELECT tblLCTypeDropbox.ID, tblLCTypeDropbox.LCType FROM tblLCTypeDropbox;

and LCTypeDropBox is a table with various ID's associated with LC types (such as ID 22 = SB - Performance LC as explained earlier.

How can I avoid this error?  

User generated image
thank you
Avatar of pdvsa
pdvsa
Flag of United States of America image

ASKER

here is the column that if deleted then the error goes away

User generated image
Avatar of pdvsa

ASKER

also, I can still Append if I click the Yes button but that column [tblLetterOfCredit].[LCTpe] will be Null.
Avatar of pdvsa

ASKER

tblLetterOfCredit.LCType is Number format
ASKER CERTIFIED SOLUTION
Avatar of IrogSinta
IrogSinta
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of pdvsa

ASKER

wow.  You are good.  That was exactly the issue.  It works perfectly.  

thank you