Create Table

  • Thread starter Thread starter Sash
  • Start date Start date
S

Sash

I have a list of column names (vertically) that I would like to create a
table using the list. Is it not possible to use SQL and use CREATE TABLE in
Access??
 
Sash said:
I have a list of column names (vertically) that I would like to create a
table using the list. Is it not possible to use SQL and use CREATE TABLE
in
Access??


Of course it is. What is the nature of the list of column names? Does your
list include the type and size of the field? In principle, if I have, a
string variable in which I create a SQL statement, like this:

Dim strSQL As String

strSQL = _
"CREATE TABLE Foo (" &
"Field1 INTEGER, " & _
"Field2 TEXT(50) WITH COMP" & _
")"

... then you can execute it like this:

CurrentDb.Execute srtrSQL, dbFailOnError

Note: the dbFailOnError constant is defined by the DAO object library, so
you should have a reference set to that library in order to use it.
 
Back
Top