i have been trying to create a table in access in the database fileName(variable) but i get the error message
syntax error in field defination.
the code sample is shown below, please help
Public Function CreateTable(ByVal fileName As String) As Boolean
Dim conn As OleDbConnection
Dim objCmd As OleDbCommand
Dim SQL As String
conn = New OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;data source=" & Application.StartupPath & "\" & fileName & ".mdb")
SQL = "CREATE TABLE USERS(Path Text(10), Username Text(10), Password Text(10))"
conn.Open()
objCmd = New OleDbCommand(SQL, conn)
objCmd.ExecuteNonQuery()
conn.Close()
MsgBox("table created successfully")
'tblname = FileName
Return True
End Function
syntax error in field defination.
the code sample is shown below, please help
Public Function CreateTable(ByVal fileName As String) As Boolean
Dim conn As OleDbConnection
Dim objCmd As OleDbCommand
Dim SQL As String
conn = New OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;data source=" & Application.StartupPath & "\" & fileName & ".mdb")
SQL = "CREATE TABLE USERS(Path Text(10), Username Text(10), Password Text(10))"
conn.Open()
objCmd = New OleDbCommand(SQL, conn)
objCmd.ExecuteNonQuery()
conn.Close()
MsgBox("table created successfully")
'tblname = FileName
Return True
End Function