Hi friends!
I got one puzzle. I wonder if there is a way I can create a table but get a table name from a value of the textbox/combo box control. Does anyone have an idea?
I mean something like "CREATE TABLE (TextBox1.Text) (".....)"

I wonder if that is really possible. I will appreciate any imputs.

The SQL command (you didn't specify what type of database) to create a table looks like

qry = "CREATE TABLE [xxxxxxx] (                      " _
    & "  [LastName]   varchar](50) NOT NULL,         " _
    & "  [FirstName]  varchar](50) NOT NULL,         " _
    & "   ([LastName](Asc))                          " _
    & ") ON [PRIMARY]"

so to create the query string you could do

qry = qry.Replace("xxxxxxx",TextBox1.Text)

then execute that query.

commented: Thanks Rev. +1

Yes. It's possible,
You can achieve this with replace method..
you need to replace your table name with your text box value.


commented: meaningless out of context -3


That is not only syntactically incorrect, but it also is a meaningless statement.

  • what is Tablename
  • what is the text that you are replacing

@savedlema - c'mon back if you need further clarification.

HI Jim,
Thanks for made my post Correct but I have not given any partlicular code there (Tablename).replace("Textbox.text") statement was not a code over there. i have just given over all idea, what shold he can use to get result.. you are doing same. you are also replacing with textbox. the difference between your post and mine was you have given code while i have given only basic logic.
You are a Moderator user of this community. you must have more experience than I have, we all new members have chance to learn from you.
with great respect of you,I am just repalying so i can clear my point of view.
Thanks Jim.