Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old September 18th, 2005, 08:55 AM
interlocutor interlocutor is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 1 interlocutor User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 41 m 11 sec
Reputation Power: 0
Exclamation Splitting One Table into Two Other Tables

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...

Reply With Quote
  #2  
Old September 22nd, 2005, 09:26 AM
mrjones mrjones is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 4 mrjones User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 6 m 14 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Splitting One Table into Two Other Tables


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT