[AccessD] Re: Create scripts: CreateTable?

Robert L. Stewart rl_stewart at highstream.net
Tue Mar 2 09:58:34 CST 2004


Sander,

Here is a little code to get you started.

Sub GetTableStructure(ByVal strTableName As String)
     ' Get the Table structure of a table
     Dim db As DAO.database
     Dim tdf As DAO.TableDef
     Set db = CurrentDb()
     Set tdf = db.TableDefs(strTableName)
     Dim fld As DAO.Field
     For Each fld In tdf.Fields
         Debug.Print fld.Name, fld.Type, fld.Size
     Next
     db.Close
     Set db = Nothing
End Sub

This will get the structure of a table you pass in the name of.

I will leave it up to you to write the code to create the text
file you will need for them to import, place in a module, and
run in order to recreate the table structure.

Hint:  Create a table that has every data type in it to see
what the fld.type is returning.

Robert

At 08:49 AM 3/2/2004 -0600, you wrote:
>Date: Mon, 1 Mar 2004 23:05:07 -0800 (PST)
>From: S D <accessd667 at yahoo.com>
>Subject: [AccessD] Create scripts: CreateTable?
>To: accessd <accessd at databaseadvisors.com>
>Message-ID: <20040302070507.73265.qmail at web61106.mail.yahoo.com>
>Content-Type: text/plain; charset=us-ascii
>
>Hi group,
>
>I need to create about 15 new, very large (25-42 fields) tables. Is it 
>somehow possible to create scripts that generate these tables to migrate 
>these tables to production? Like in SQL-Server?
>
>My suggestion was create the tables in Developmennt. Import the tables in 
>the Test environment and then import them into Production. Answer: NO. 
>Why? Just NO. Create scripts that generate the objects and we (third 
>party) run the script.
>
>Is there something like it?
>
>regards,
>
>Sander





More information about the AccessD mailing list