Atalasoft
Welcome to Atalasoft Community Sign in | Join | Help
in

text as table in database

Last post 13 Jan 2004, 3:50 PM by Never. 1 replies.
Sort Posts: Previous Next
  •  26 Dec 2003, 8:17 PM 4590

    text as table in database

    I'm a 54 years old teacher, newbie in Visual Basic 6.0, who makes programmes for children. The programmes are freeware on the site www.snuffelsoft.be (in Dutch only) Now I want to create a table in a database (ADO) but the name of the table had to be a word from a textbox . Children had to fill there name in that textbox and a copy of a table (grammar words) must be made in the database. So each child can work with his own table .
    This is the code I wrote:

    Set cn = New Connection
       Set rsnew = New Recordset
       With cn
           .Provider = "Microsoft.jet.oledb.4.0"
           .ConnectionString = App.Path & "\spel3.mdb"
           .Open
       End With

    If rsnew.State = adStateOpen Then
       rsnew.Close
     End If
    rsnew.Open "Select * into" & "
    txtname " & "from basic3", cn, adOpenKeyset, adLockOptimistic

    This is the code, and I want to change the
    txtname into a name from a textbox .
    So I can create a table called Marie or Jim or Bart or ...
  •  13 Jan 2004, 3:50 PM 4591 in reply to 4590

    RE: text as table in database

    let say your textbox control is called txtName, the line will be:
    rsnew.Open "Select * into [" & txtname.text & "] from basic3", cn, adOpenKeyset, adLockOptimistic

    NOTE:
    I'm using the [] to surround the name, this will allows the user to select a reserved word as a name for the table.
View as RSS news feed in XML