Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
|
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 10th, 2003, 11:47 PM
Registered User
 
Join Date: Nov 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Appending Records from One table to another

Hello all,

I write in VB6 using Access2000 as my database.

I want to write a small utility to append data records from one table (in one database) to another table (in another database). Apparently the two tables have almost same field names. How do I go about it. I mean one or two line commands that will do the appending.

Thanks

-Tallon


 
Old November 11th, 2003, 05:39 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 231
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can do it using a single SQL statement, you just need to fully qualify your table names:

Code:
INSERT INTO FileName1.TableName
    (SELECT * FROM FileName2.TableName
     WHERE Any condition you need)
     This will insert all the rows from the table in FileName2 into the table in FileName1.


Regards
Owain Williams
 
Old November 11th, 2003, 11:40 AM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

From db1 create the following query

INSERT INTO Table1 ( Field2, Field3, Field4, Field5 )
SELECT Table1.Field2, Table1.Field3, Table1.Field4, Table1.Field5
FROM Table1 IN 'E:\db2.mdb';


this gets values from db2/table1 and inserts them into db1/Table1. You can create a query programatically as well. You may be able to pass this string on a command object.






Sal
 
Old September 9th, 2008, 05:42 AM
Registered User
 
Join Date: Jan 2008
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello

I am using windows XP

I need a small programme in Visual basic 6 with Access 2000

I have two tables for example one table named student other table named section

In student table rno is primary key. In section table Rollno is primary key


Both tables have datas, I want to insert datas from student to section.

The coditions is unique datas only (ie. some datas already in section while inserting
datas from student to section the existing datas should be eliminated they wont be inserted)
( by comparin rno with rollno)( i avoid duplicate appending)

Please me code for inserting tables using ADODB recordset




A.Senthil kumar

 
Old September 9th, 2008, 11:29 AM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

imagetvr, it is extremely bad form to hijack someone else's posting.

To all: This question is at http://p2p.wrox.com/topic.asp?TOPIC_ID=73935

Please answer imagetvr there, instead of here





Similar Threads
Thread Thread Starter Forum Replies Last Post
Appending a Table to a Catalog using ADOX ShoeBucket Access VBA 3 June 15th, 2007 01:58 PM
copy and append records from table-A to table B bhunter Access 6 March 9th, 2004 02:02 PM
appending a field to a table Dmouse Access ASP 1 February 29th, 2004 05:18 AM
Appending Records from One table to another Tallon Wolle Pro VB 6 1 November 20th, 2003 03:26 PM
thousands records enter one table to another table mateenmohd SQL Server 2000 3 July 17th, 2003 07:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.