i simple was to add information in a listview using save button.
but when click save it hangs.kindly help me .any help would be
Greately appreciated.
here is the code what i have written.
Private Sub btSave_Click()
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
' On Error GoTo ErrHnd
If (CheckInput) = True Then
If MsgBox("do you add this record", vbYesNo + vbQuestion, "message") = vbYes Then
Set con = New ADODB.Connection
If OpenConnection(con) Then
MsgBox ("Cannot open Connection")
End If
Set rs = New ADODB.Recordset
rs.Open "Select * from supplierS", con, adOpenDynamic, adLockOptimistic
rs.AddNew
rs.Fields("type_id") = Combo1.ItemData(Combo1.ListIndex)
' rs.Fields("item_type") = Combo1.Text
' rs.Fields("sup_id") = Val(Text1.Text)
rs.Fields("Sup_name") = TxtSupName.Text
rs.Fields("Contact_person") = TxtCperson.Text
rs.Fields("contact_no") = TxtContactNo.Text
rs.Fields("office_address") = TxtOfficeAdd.Text
rs.Fields("email") = Txtemail.Text
rs.Fields("website") = TxtWebsite.Text
rs.Fields("fax_no") = TxtFax.Text
rs.Update
rs.Close
MsgBox ("Data Saved")
Call frmSupplier.Addtolistview
End If
End If
' Call CloseConnection(con)
Exit Sub