Creating table columns with VBA

snypa

Registered User.
Local time
Today, 06:57
Joined
Feb 2, 2009
Messages
29
Hi Guys

I am trying to create columns in a table using VBA. The names of the columns will come from a query that extracts the Column Name from another table.

Psuedo Code:

input = input.txt

-> Select ColumnName from TableA Where TableA.TableName = input
-> Feed records into a recordset
-> Loop through the recordset creating columns with the names from the results of the loop.

What is the best way of doing this?

Thank u in advance
 
I don't mean to be rude (although it will seem I am), but in most cases, the desire to create multiple similar-structured tables in code, indicates a serious flaw in the database design.

What are you trying to achieve? What purpose is fulfilled by the creation of these tables?
 
Thanx for thr reply

I'm trying to recreate a database from an Excel dump of a database. So I have the table names and the columns for each of these tables. So I imported this list into a table and I would like to use the records I have in this table to recreate the database from the excel dump. The Dump has at hundreds of tables and over 5000 columns so I cant manually do it

Hopefully this helps.
 
Ah, no problem - I thought you were trying to build something into a database for ongoing use.

So... is it that you have a bunch of tables you just want to replicate in a different db? - if so, the external data wizard will do this - and will import just the table structures, if you tell it.
 
Oh,

I'll try that, will it import the structure from an excel sheet dump though?

Thanx
 

Users who are viewing this thread

Back
Top Bottom