i want when user clicks on save button I want to update the database and refresh the listview on the curren page.
i have written a code but data is not instantly comming after save button .Here is the code what i have written.I simple Want when Press ok .addded record should go in a listview.but is not refreshing.
Private Sub Command2_Click()
If (CheckInput) = True Then
End If
y = MsgBox("do you add this record", vbYesNo + vbQuestion, "message")
If y = vbYes Then
Set con = New ADODB.Connection
Dim success As Boolean
success = OpenConnection(con)
If success = False Then
MsgBox ("Cannot open Connection")
End If
Set rs = New ADODB.Recordset
rs.Open "Select * from supplierS", con, adOpenDynamic, adLockOptimistic
rs.AddNew
' rs.Fields("item_type") = Combo1.Text
rs.Fields("id") = Val(Text1.Text)
rs.Fields("Supplier_name") = Text2.Text
rs.Fields("Contact_person") = Text3.Text
rs.Fields("contact_no") = Text4.Text
rs.Fields("office_address") = Text5.Text
rs.Fields("emails") = Text6.Text
rs.Fields("website") = Text7.Text
rs.Fields("fax_no") = Text8.Text
rs.Update
rs.Close
Set rs = Nothing
con.Close
Set con = Nothing
Me.Refresh
MsgBox ("Data Saved")
Supplier_master.Refresh
Combo1.Text = ""
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
' con.BeginTrans
' SQL = "INSERT INTO Supplier(item_type,Supplier_id,Supplier_name,Contact_person,Contact_no,Office_address,emails,website,Fax_no) values('" & Combo1.Text & "','" & Text1.Text & "','" & Text2.Text & " ','" & Text4.Text & "','" & Text3.Text & "','" & Text5.Text & "','" & Text6.Text & "','" & Text7.Text & "','" & Text8.Text & "')"
' con.Execute (SQL)
' MsgBox SQL
' con.CommitTrans
' MsgBox (Combo1.Text)
End If
End Sub