VBA coding question There is a form I I am having a trouble
VBA coding question
There is a form
I
I am having a trouble with ADD and Delete button.
when I add some information through Add key
the error message poped up like this \" the yellow line\"
These are some portion of the entire code.
Please give me the solution for ADD and Delete button.
Thanks./
Private RecCount As Integer Private Current CusNo As nteger Private Sub UserForm-Activate() EnableButtons Create Db0b jects With Sheets \"Data \").cboCustomer I bl Customer & .List List Index, 0) Current CusNo List List Index, 1) End with RefreshRecordset CurrentCusNo End Sub Private Sub Enable Buttons For Each ct l n Controls Select Case TypeName( ct l Case \"CommandButton\" ct I. Enabled True Case Text Box\" ct I Enabled False End Select Next cmdCancel Visible False End Sub Private Sub RefreshRecordset ByVal ThiscusNo As nteger On Error GoTo error_handle: sq l Select From Orders Where CusNo & This CusNo & Order By PurchDate rs. Upen Sq If rs. BOF And rs.E0F Then Rec Count cmd Add Click Else rs. Move Last Rec Count rs, Record Count rs MoveFirst rs. Find \"CusNo & This CusNo Update Text Boxes End If Exit Sub error handle Select Case Err.Number Case 91 Create Db0bjects Resume Case 3705 rs. Close Resume Case Else MsgBox Err Number & & Err Description End Select End SubSolution
ANSWER
ADD
 btnCommit.Enabled = True btnAddNew.Enabled = False
 btnUpdate.Enabled = False
 btnDelete.Enabled = False
txtFirstName.Clear()
 txtSurname.Clear()
DELETE
 Dim cb As New OleDb.OleDbCommandBuilder(da)
 ds.Tables(\"AddressBook\").Rows(inc).Delete()
 MaxRows = MaxRows - 1
 inc = 0
 da.Update(ds, \"AddressBook\")
 NavigateRecords()

