Hi Friends

While adding record in Ms-Access using ADODB... Last record in the database is replaced instead of adding .. I dont know why??
Plz any one help me..
Code :
Private Sub cmdAdd_Click()
If ((IsNumeric(txtincome.Text) = True) And (IsNumeric(txtmobile) = True) And (IsNumeric(txtnum) = True)) Then
Datacontrol.Recordset.MoveLast
Datacontrol.Recordset.AddNew
Datacontrol.Recordset.Requery
Validate = MsgBox("1 Record Added ", vbOKOnly, "Validate")
locked
Else
Validate = MsgBox("Enter the appropriate value ", vbOKOnly, "Validate")
End If
End Sub

I think it goes like this with ADO:

Datacontrol.Recordset.AddNew
'Datacontrol.Recordset.Fields("<fieldname>") = <value>
Datacontrol.Recordset.Update

simply try using this

conn.begintrans  'CONN---ADODB CONNECTION OBJECT.
conn.execute "YOUR INSERT STATMNET HERE"
conn.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.