|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello,
Here is what I am trying to do: I have 3 tables - Table_1, Table_2, Table_3. Table_1: RECORD#1:Name,Age,Address1,Address2,Address3,Addre ss4 I want to split the above into 2 tables containing the following info: Table_2: RECORD#1:Id(AutoNumber),Name, Age Table_3: RECORD#1:LocalId,Address1 RECORD#2:LocalId,Address2 RECORD#3:LocalId,Address3 RECORD#4:LocalId,Address4 **Note:In Table_2 "Id" is the Primary Key. Also Table_2 and Table_3 are linked with the following relationship: Id in Table_2 is linked to LocalId in Table_3. But "LocalId" is not a primary key. So for every Record in Table_2, you could potentially have 4 records in Table_3. I am trying to write a VB code to perform this function. A part of my code is: Dim con As ADODB.Connection con.Execute "INSERT INTO Table_2 (Name,Age) VALUES ( Name & Age) I am able to add records to Table_2 but cannot add records to Table_3. Please help... |
|
#2
|
|||
|
|||
|
Simple solution
This may seem like a simple solution, however, I wouldn't do all that coding. I'd just create the additional tables you need and the fields and remove them from the other tables. If you have information in the fields then copy those over too. Make sure you have the same primary key in all three tables and that will be your relationship. That's probably why you cant copy to Table 3. Why do you have a different primary key? It seems to me that you are creating more work for yourself. Work smarter not harder dear.
![]() |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > Splitting One Table into Two Other Tables |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|