Private Sub cmdLogin_Click()
Dim comSave As New ADODB.Command
Dim sqlAdd As String
Set RS = New ADODB.Recordset
With comSave
.ActiveConnection = ConnDB
.CommandType = adCmdText
End With
ConnDB.BeginTrans
sqlAdd = "INSERT INTO UserName (FullName,IDCard,CustomerID,Office,Address,Telephone,UserId,UserPwd)"
sqlAdd = sqlAdd & "VALUES('''& txtFullName.Text & ''', ''' & txtIDCard.Text & ''', ''' & txtCustomerID.Text & ''',''' & txtOffice.Text & ''' ,''' & txtAddress.Text & ''',''' & Telephone.Text & ''',''' & txtUserName.Text & ''', ''' & txtPassword.Text & ''')"

Please,help me.I can't record my DataBase.

Hi,
As you given in the thread is not clear because there is no recordset declaration but you setting recordset so if you need to know where is wrong then you have to give full code (i.e) connection and recordset declaration and way of using it.

Have a nice day,
Shailaja :)

Private Sub cmdLogin_Click()
Dim comSave As New ADODB.Command
Dim sqlAdd As String
Set RS = New ADODB.Recordset
With comSave
.ActiveConnection = ConnDB
.CommandType = adCmdText
End With
ConnDB.BeginTrans
sqlAdd = "INSERT INTO UserName (FullName,IDCard,CustomerID,Office,Address,Telephone,UserId,UserPwd)"
sqlAdd = sqlAdd & "VALUES('''& txtFullName.Text & ''', ''' & txtIDCard.Text & ''', ''' & txtCustomerID.Text & ''',''' & txtOffice.Text & ''' ,''' & txtAddress.Text & ''',''' & Telephone.Text & ''',''' & txtUserName.Text & ''', ''' & txtPassword.Text & ''')"

Please,help me.I can't record my DataBase.

I set it that you advice , but it's can't to solved this problem

Dim comSave As New Recordset
Dim sqlAdd As String
With comSave
.ActiveConnection = ConnDB
.CommandType = adCmdText
End With
sqlAdd = "INSERT INTO UserName (FullName,IDCard,CustomerID,Office,Address,Telephone,UserId,UserPwd)"
sqlAdd = sqlAdd & "VALUES('''& txtFullName.Text & ''', ''' & txtIDCard.Text & ''', ''' & txtCustomerID.Text & ''',''' & txtOffice.Text & ''' ,''' & txtAddress.Text & ''',''' & Telephone.Text & ''',''' & txtUserName.Text & ''', ''' & txtPassword.Text & ''')"

Please,help me.I can't record my DataBase.

Dim comSave As New ADODB.Command
[B]Set[/B] comSave.Activeconnection = connDB

Good Luck

Why you need a command object or a recordset for an insert statement ?
simply try this

con.begintrans                'con ----adodb connection object.
con.execute sqlstring      'sqlstring ----your insert statement
con.committrans
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.