Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
; setup constants... acTable = 0 acImport = 0 SourceMDBName = "C:\Data\Access\LogFile.mdb" DestinationMDBName = "C:\Data\Access\Naruni.mdb" SourceTableName = "Log Table" DestinationTableName = "New Log Table" ; open access... accessDB = ObjectOpen("Access.Application") ADB = accessDB.Application dbname = DestinationMDBName ADB.OpenCurrentDatabase(dbname) ADB.Visible = @FALSE ADB.UserControl = @FALSE ; reference the DOCmd method... ADBCmd = ADB.docmd ; set up the ref to tabledefs collection... db = accessDB.currentdb tdefs = db.tabledefs tlist = @FALSE ; loop thru the table defs... For t = 0 To tdefs.count-1 ; setup the ref for this table in the collection... table = db.tabledefs(t) ; check to see if the table already exists... If table.name == DestinationTableName tlist = @TRUE Break EndIf ObjectClose(table) Next ; if table exists delete it... If tlist Then ADBCmd.DeleteObject(acTable, DestinationTableName) ; this will copy the whole table from the source to the destination... ADBCmd.TransferDatabase (acImport, "Microsoft Access", SourceMDBName, acTable, SourceTableName, DestinationTableName) Drop(tlist) ObjectClose(tdefs) ObjectClose(db) ObjectClose(ADBCmd) ObjectClose(ADB) ObjectClose(accessDB) Message("Debug", "All Done") Exit
Article ID: W16100
File Created: 2004:03:30:15:42:52
Last Updated: 2004:03:30:15:42:52