Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2002
    Location
    Charlotte, NC
    Posts
    45

    Angry Unanswered: Creating/Naming a New Table with Textbox

    Can someone help this newbe?

    I have a form with a Textbox. It asks: "Please Enter a name for your new Table:"

    The user enters a name in the textbox and presses Enter.

    Now, it should create a NEW TABLE .. named according to what the user just typed.

    Can anyone help me out?

  2. #2
    Join Date
    Nov 2001
    Posts
    336
    Hi,

    What is the structure of the table? Is it always the same and only the name can be specified by an user?

    Igor

  3. #3
    Join Date
    Oct 2002
    Location
    Charlotte, NC
    Posts
    45

    Post Structure

    The table structure will always be the same. The user will be working via a switchboard (with little knowledge of what is happening in the background). They will type in the name they want to name the new table and click a button (or press enter).

    I have a template (a blank table) with what each new table will look like.

    My problem lies with the coding. How to code it to .. 1) Make a new table with certain collumns i specify.. 2) Name it what was just entered via a textbox...

    I appreciate any clues. Thanks.

  4. #4
    Join Date
    Nov 2001
    Posts
    336
    Hi,

    Code below may help you to solve your problem. Make sure that user enters valid table name and a table with such name already exists.

    dim strSQL as String

    if NZ(me.txtNewTableName,"") = "" then
    msgbox "Please specify valid table name."
    me.txtNewTableName.setfocus
    exit sub
    end if

    strSQL = SELECT * INTO " & me.txtNewTableName & " FROM tblTemplate;"
    currentdb.execute strSQL

    HTH, Igor

  5. #5
    Join Date
    Oct 2002
    Location
    Charlotte, NC
    Posts
    45

    Exclamation Update: Found what I needed

    Thanks for the advice. I found exactly what I needed with the "CopyObject" action.

    It allowed me to make a copy of my template and name it with information provided by a textbox.

    Thanks again.

    stratego

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •