I am making two tables in a DBASE - Giving and Members -- The Members has a primary key of HouseholdName with all the member details (address, name, etc.) ---
The Giving table uses a PK ID.
I go to the Dataset designer and I click on the HouseholdName (PK) in the Members table and drag to the HouseholdName in the Giving table --- a menu pops up and I select Foreign Key Constraint only.
I want every giving instance to have a HouseholdName attached.... simple right???
NOT -- I put in a couple rows of data -- the HouseHold name FK in Giving has the same names as the ones in the Members table (see below) but when I run it, I get this error:
Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
I have checked and re-checked and do not know what is wrong. *** I know the names are the same, the types are the same... I even tried dragging the OTHER way in my Diagram and still got the same error.... can someone please help me?
Thanks!!!!
GIVING TABLE:
| 1 | 7/1/2007 12:00:00 AM | G | 100.0000 | VanceTE |
| 2 | 7/4/2007 12:00:00 AM | T | 300.0000 | LarsonJL |
| 3 | 6/5/2007 12:00:00 AM | T | 450.0000 | VanceTE |
MEMBERS TABLE:
| AndersonAA | John | Anderson | 111 Blvd | Chatham | IL | 61111 |
| BakerBB | Paul & Doris | Baker | 222 Street | Springfield | IL | 62222 |
| LarsonJL | John & Blaine | Larson | 111 Avenue | Auburn | IL | 61111 |
| VanceTE | Todd & Dawn | Vance | 1560 W. Decatur | Decatur | IL | 62522 |

Todd VancePosted Aug 16, 2007, 9:16 AM
Thank you,,,, I got this one figured out. (At least I got it to work) ---
I dont know why the Dataset designer allows me to make the Foreign Key stuff but I had to delete all that.
Instead I had to go into the Table Definition of the Foreign Key and click the Relationships button - ADD a relationship, then click on the elipse next to 'Tables and Columns Specifications' from there I make the relationship.
This makes it work correctly.
=================
******** FYI - When you go to make a Foreign Key relation in VS express --- you have to choose the Column in the Table that will be the FOREIGN KEY! You cannot choose the Column that isthe Primary Key because for some reason the Relations dialog will not let you change the Foreign Key field - trust me, just pick the column in the table that contains the Foreign Key, Click Relations, and set it up that way. If you want further clarification just email me at [email protected]
****************
Munir ShaikhPosted Aug 16, 2007, 12:17 AM
Try this URL on microsoft:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=364416&SiteID=1
I think this will solve your problem.
Regards,
>>Munnamax