BrianBeck
asked on
How to copy Access Table Structure using ADOX/ DAO
Hi Gurus
I need to know how to copy the structure of a given table in db_SOURCE to db_DEST. Structure needs to include essential aspects such as field names, field type, field properties and index fields.
Your help is most appreciated.
I need to know how to copy the structure of a given table in db_SOURCE to db_DEST. Structure needs to include essential aspects such as field names, field type, field properties and index fields.
Your help is most appreciated.
Why cant u just issue a copy object?
Im assuming u are using VB and Access DB
I was thinking along the lines of this
Now if u copy an object, it should copy everything across for u
Public Sub CopyTable()
Dim acc As Object
Set acc = CreateObject("Access.Appli cation")
acc.OpenCurrentDatabase ("C:\mydb.mdb")
acc.DoCmd.CopyObject , "db_DEST", acTable, "db_SOURCE"
acc.CloseCurrentDatabase
Set acc = Nothing
End Sub
Im assuming u are using VB and Access DB
I was thinking along the lines of this
Now if u copy an object, it should copy everything across for u
Public Sub CopyTable()
Dim acc As Object
Set acc = CreateObject("Access.Appli
acc.OpenCurrentDatabase ("C:\mydb.mdb")
acc.DoCmd.CopyObject , "db_DEST", acTable, "db_SOURCE"
acc.CloseCurrentDatabase
Set acc = Nothing
End Sub
ASKER
Hi rockiroads
Thanks, but after experience I deliberately want to bypass Access and just make use of either ADOX or DAO.
I figure that with the above method of fetching field types, all I have to do is create a new table with the respective field names, types etc. I expect to get to that stage within the day, and will update you. If you have any suggestions, I most welcome them.
Thanks, but after experience I deliberately want to bypass Access and just make use of either ADOX or DAO.
I figure that with the above method of fetching field types, all I have to do is create a new table with the respective field names, types etc. I expect to get to that stage within the day, and will update you. If you have any suggestions, I most welcome them.
ok then. I guess u had some bad experiences using objects. And I thought I gave a easy answer :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi rockiroads
Thanks, and timely. I got my 'copy table structure' routine with handling field types, but hadnt done the indexes so your code is most handy.
Thanks, and timely. I got my 'copy table structure' routine with handling field types, but hadnt done the indexes so your code is most handy.
Cool
ASKER
http://www.thescripts.com/forum/thread189610.html