Discussion Locked
0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I need to be able to copy the structure of an existing Access table in VB, checking to see if a couple of columns exist, if not, creating them, and saving them with a new name. Is this possible programatically?
3 replies
by john.a.wills
put this question in Technical Q & A.
by pws442442
Sorry, and I did it again, because the page gave an error.
by politot
Presuming you're doing this via VBA code in your Access Database, use the "DoCmd.CopyObject". But to make sure you don't get "system" tables (hidden ones created by Access), use:
Dim t as TableDef
For Each t In CurrentDb.TableDefs
If t.Attributes = 0 Then 'zero = user table
DoCmd.CopyObject sBUTName, "", acTable, t.Name
End If
Next
You can theoretically use this to copy any Access object (table, query, form, report, etc) within a database or to a different database file.
This discussion is closed to new replies.
Trending Software posts
Sort by Trending
1 helpful
1 reply
Question Unanswered
How Are Teams Testing AI-Generated Code Before Production?
0 helpful
0 replies
0 helpful
5 replies
0 helpful
20 replies
Discussion
Is There any Reverse Video Search Tool
0 helpful
8 replies