Create Table / Add Fields

TimTDP

Registered User.
Local time
Today, 18:08
Joined
Oct 24, 2008
Messages
213
I have a need to create tables using vba (DAO)

I have two tables, tblCreateTable & tblCreateTableFields

After I have selected the table I need to create in tblCreateTable, I need to create a recordest of the table's fields in tblCreateTableFields and create the table.

I understand how to select the table, and recreate the recordset

I am unsure of how to:
* Create the table
* loop through the recordset and add the fields to the table

Thanks in advance
 
Tim, it is possible but is there any reason why you don't want to create the table (using the built-in designer) before-hand?
 
Is this an educational question or a real time question?
 
Yes, we know about that resource but like we asked, what is the purpose of this exercise? It is very uncommon for a developer to need to create tables on the fly unless it's a big commercial db that does alot of archiving (depending on the setup). If you're needing to do this on a regular basis then this would suggest a problem with the structure of your db.
 
99% of the tables in my database are linked to a backend database
I needed to rebuild the frontend and had to remember which tables in the frontend were unlinked. All the unlinked frontend tables hold temporary data.
So I thought I would simply create tables matching the unlinked tables, and then when rebuilding the frontend I could simply:
* link all the tables from the backend
* run a function to create the unlinked tables.
simple as that!
 

Users who are viewing this thread

Back
Top Bottom