and this my code to Save Data in MSAccess Using Listview
Code:
Private Sub savetodailyrecord()
Dim lstSel As ListItem
Dim str As String
For Each lstSel In ListView1.ListItems
str = "Insert Into Dailyrecord (Receipt, BarCode, ProductName, Quantity, Price, TotalPrice, purchase_date) Values ('" & lstSel.Text & "', '" & lstSel.SubItems(1) & "','" & lstSel.SubItems(2) & "','" & lstSel.SubItems(3) & "','" & lstSel.SubItems(4) & "','" & lstSel.SubItems(5) & "'," & lstSel.SubItems(6) & ")"
acd.Execute str
Next
Call Purchase
ListView1.ListItems.clear
End Sub
But if my Data in Listview is only one.. My Program Run Correctly and Save the Data to DB, but in My listview had many data VB 6.0 Say: syntax error in the query expression
Use Debug.Print str, then paste the contents of that into Access (SQL Editor). It will highlight on the first position of the first error. When there are no more errors, change VB6 to match EXACTLY.
Bookmarks