Article ID: 110588
Article Last Modified on 10/29/2003
INSERT INTO ToTableName SELECT * FROM FromTableNameYou can also add a WHERE clause at the end to add any selected records:
INSERT INTO ToTableName SELECT FromTableName.* FROM FromTableName
WHERE Key = 'Key'
Dim db As database, ds As dynaset
Set db = OpenDatabase("C:\VB3\FOXTEST", False, False, "foxpro 2.5;")
db.Execute "INSERT INTO ToTableName SELECT FromTableName.*
FROM FromTableName"
Dim MyDB As Database, Tbl1 As Table, Tbl2 As Table
Set MyDB = OpenDatabase("BIBLIO.MDB") ' Open Database.
Set Tbl1 = MyDB.OpenTable("Publishers") ' Open Table.
Set Tbl2 = ...
For i = 0 to Tbl1.Fields.Count - 1
Tbl2(Tbl1.Fields(i).Name).Value = Tbl1.Fields(i).Value
Next
The above loop assumes that the fields in table 2 are identical to those
in table 1.
Additional query words: 3.00
Keywords: KB110588