A1VBCode Forums

createing 2 or more tables


http://www.a1vbcode.com/vbforums/Topic30337.aspx

By daveofgv - 4/23/2011

I might just be one of the few that just can't get it.......

If someone can explain it to me in a 2nd grade level (step by step) I would be very appreciative.....

I have 2 tables:

table 1: first_name, last_name, ssn, city

table 2: charge, chargecity, chargestate, chargeamount (which these are for charges when someone is arrested)

I can create one table and everything is just fine in my windows form (visual studio 2008 pro)

However, when I create 2 tables (like above) I can not get the "charges" to associate with the last_name. I have to add another entry which would cause duplicate records for one person.

Example: when a person goes to jail they get a charge (DWI). When the person goes to jail again they get another charge but I can't seem to find how to add it to the person already in my database.  If last_name is the primary key I don't understand how to add another charge and it show up under the persons name in my datagrid.

If I had one table everything would be fine, however, I would have to keep changing the charge instead of creating a "running total"

Am I not getting something here???

Hope this is simple to read

thanks

daveofv

By toxiod - 5/2/2011

hi daveofv,



you have to use an id or primary key that will reference to the second table id, you can do it by editing you recordset put some relationship between the 2 table. making the first table your mother and the second table is the child so that when you drag it your data into you form it will automatically create a relationship of you data and will save synchronously to your database.



to download a program sample that has a same function of that here's the link: http://forum.computerscienceguide.com/viewtopic.php?f=2&t=12