April 11th, 2013, 02:41 PM
[RESOLVED] Its Urgent please solve my create table query in vb6
for my project i need to create a table. But name of table given by user in a text box
I am using Ms Access 2007 database and vb 6.0
i have written following code but getting error " Error in create table statement "
Private Sub Command1_Click()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Administrator\My Documents\project1.mdb;"
Dim id As String
id = text1.text
rs.Open "Create table" + id + "(id int)", cn
I code is running if i write table name instead of variable
rs.open "Create table abc (id int)",cn
this code is working
but i need to create a table by given value
please help me
Thanks in advance
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.