Integrity constraint violation when inputting data into a form using a listbox

asked 2021-04-18 08:56:40 +0200

anasteso1454 gravatar image

I will first say I hardly know what I am doing. I have spent literally hours (all weekend) trying to solve this problem myself using the Base 6.4 manual and searching some forums. This is my first time using Base and it is pretty frustrating.

Now that my gripe is out of the way, I am building a sports trading card database with several tables and a data entry form. I have a main table -- card collection, and several other tables I have tried to create so that I can enter some of the data using list boxes: Card Type, Card Year, Card Publisher, Card Brand. Each has its own primary key. I have entered relevant data into each table along with the key. The screenshots on this post will show the format of each table and the table relations I have set up, and the error message I get when I attempt to enter data using the "Card Type" and "Card Year" list boxes: integrity constraint violation - no parent.

I have scoured all of my tables for missing data, or blank cells and there are none. In the "Type" table there are nine entries but in the main table I have used only three so far. The ID key formats match from table to table (except for, oddly enough, the "publisherID" and "brandID" fields but both of those are working correctly on the form). I chose "tinyint" as the ID format in order to save space--could that be the problem? Or could the problem be in the way the relations are set up? I have them all set to "update cascade" and "delete cascade" but I dont know if that is correct. I noticed the TypeID and CardTypeID relation has the TypeID = 1 : CardTypeID = n and I though perhaps that is backwards but I cannot reverse it. Or maybe it is something else entirely that is causing the problem?

table format screenshots: main table https://imagebin.ca/v/5ypg8ipo4qSW Type table https://imagebin.ca/v/5ypgVCZlpoCn Year table https://imagebin.ca/v/5ypgq7Wu5Vyy publisher & brand table (for comparison) https://imagebin.ca/v/5yph2ITNsNUO

table relationships https://imagebin.ca/v/5yphHazWgPl3 error message https://imagebin.ca/v/5yphYlefJ32P

list box and form screenshots type list box properties https://imagebin.ca/v/5yphp0FJ1RTV type list box SQL https://imagebin.ca/v/5ypi3zPHWzFJ publisher list box properties (for comparison) https://imagebin.ca/v/5ypiKDzvFQTp publisher list box SQL (for comparison) https://imagebin.ca/v/5ypiWiIZKz4T

edit retag flag offensive close merge delete

Comments

Hello,

Have had an initial look at your images. Images are not helpful in this manner. Requires jumping around from screen to screen just for some basic comparisons. Instead, it is better to post a sample database (no personal or confidential information). Please do that here as you screen shows many problems. As you state this being your first time with Base (this is only a front end to a database which you have not stated the one in use), you should not be jumping in to the deep end of the pool if you do not know how to swim.

Some examples. In Main table you placed CardBrandID but there is no table this is associated with. Other ID types are not consistent as stated (tiny int - better as Integer with auto increment). Type table shows field of SportType but in the relations screen there is no such field ...(more)

Ratslinger gravatar imageRatslinger ( 2021-04-18 19:03:01 +0200 )edit