0

I Need To Move a Record
from one Table in a
Database To another Table
I am using ado in vb 6.0 plz help me!

Edited by pritaeas: Moved to VB.

4
Contributors
4
Replies
13
Views
3 Years
Discussion Span
Last Post by kgariando
0

You didn't provide the table structures so I'll assume the tables have the same structure. I have no idea how much detail you need so I'll start with a little and you can ask for more as you need. If you have an ADODB.Connection object named con then you can move the record in two steps. Step 1 will copy the record and step 2 will delete the record from the source table. Because you have provided no details I can give only an example.

con.Execute("INSERT INTO Table2 SELECT * FROM Table1 WHERE SomeField = 'Some Value'")
con.Execute("DELETE FROM Table1 WHERE SomeField = 'Some Value'")

Edited by Reverend Jim

0

Of course, you should do error checking at each step to ensure that you don't delete the record if it fails to insert into Table2.

0

What I suggest is, firstly call the records from the First Table that you need to transfer on to a VB Form on to Text boxes or a ListView.Then save those records in the table you require. Then write the Deleting Codes on to the same Button Following the Saving Codes, to be executed from the previous table.

0

Just go into Access and create a query. Make sure that it works. Then plug the result into VB6. For how to create a query

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.