Prev: Form Dirty question when used with unbound textbox and VB Code.
Next: Macros "Where Condition" not working properly
From: Sash on 9 Feb 2010 14:21 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??
From: Dirk Goldgar on 9 Feb 2010 14:46
"Sash" <Sash(a)discussions.microsoft.com> wrote in message news:DBB9D391-7601-4B24-ABD7-15ED21BFA8B7(a)microsoft.com... >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. -- Dirk Goldgar, MS Access MVP Access tips: www.datagnostics.com/tips.html (please reply to the newsgroup) |