Hi Guys,

Is it possible to dynaically create table name in MS Access:

Below is my CODE:

strSQL = "CREATE TABLE" + Me.Text + "( ID Counter," & _
"Name TEXT(50) NOT NULL," & _
"PRIMARY KEY(ID) )"

But,im getting a run time error that syntax is wrong.
Appreciate your help!

this is the general syntax for creating tables

CREATE TABLE
[ database_name . [ schema_name ] . | schema_name . ] table_name
( column_name <data_type> [ NULL | NOT NULL ] [ ,...n ] )

so using your code to create a sample table(even though i don't know what you want to call the table from your code so am using 'personel')

CREATE TABLE Personel
 (ID INT NOT NULL,
  Name VARCHAR(40) NOT NULL)

Thanks for ur reply ..i got it..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.