954,557 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

DYnamically Creating Table Name?

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!

vammy
Light Poster
44 posts since Nov 2011
Reputation Points: 8
Solved Threads: 0
 

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)
Netcode
Veteran Poster
1,021 posts since Jun 2009
Reputation Points: 43
Solved Threads: 67
 

Thanks for ur reply ..i got it..

vammy
Light Poster
44 posts since Nov 2011
Reputation Points: 8
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: