Not connected to the database

Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim str As String

Private Sub Form_Load()
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\School Management System\Data\vihanga.mdb;ReadWrite Security Info=False"
rs.Open "select*from studentdataone", con, adOpenDynamic, adLockBatchOptimistic

Private Sub Command2_Click()
rs.Fields("GRADE").Value = Combo1.Text
rs.Fields("CLASS").Value = Combo2.Text
rs.Fields("ADMD").Value = DTPicker2.Value
rs.Fields("ADMNO").Value = Text5.Text
rs.Fields("PHOTO").Value = str
rs.Fields("NICNO").Value = Text10.Text
rs.Fields("SCENNO").Value = Text6.Text
rs.Fields("GENDER").Value = Combo4.Text
rs.Fields("DOB").Value = DTPicker1.Value
rs.Fields("NAMEF").Value = Text7.Text
rs.Fields("NAMEI").Value = Text8.Text
rs.Fields("GUAR").Value = Combo3.Text
rs.Fields("BCNO").Value = Text9.Text
rs.Fields("RECNO").Value = Text2.Text
rs.Fields("SYSD").Value = Text1.Text
rs.Fields("SYST").Value = Text3.Text
MsgBox "Data Saved Successfully ....!!! ", vbInformation
End Sub

Private Sub addnew_Click()
End Sub

When I RUN the Programe and enter the data to the fields
It shows the message "Data Saved Successfully ....!!! "

then I click the NEW button the following message displays

Run Time Error - 2147217836 (80040e54)
Number of Rows with Pending Changes exceeded the limit
I check the database but Data not saved in the table.

Whats wrong please help me

0 answers