Private Sub BtnAdd3_Click()
Set OBJLIST = ListView1.ListItems.Add(, , Text1.Text)
OBJLIST.SubItems(1) = Text4.Text
OBJLIST.SubItems(2) = Text3.Text
OBJLIST.SubItems(3) = Combo2.Text
OBJLIST.SubItems(4) = Text5.Text
OBJLIST.SubItems(5) = Text7.Text
OBJLIST.SubItems(6) = Text8.Text
OBJLIST.SubItems(7) = Text9.Text
OBJLIST.SubItems(8) = Text11.Text
End Sub
Private Sub BtnEdit3_Click()
SQL = "SELECT * FROM [NOTE]"
.Open SQL, CON, 1, 2
For i = 1 To ListView1.ListItems.Count
a = "DOC_NO <>" & ListView1.ListItems(i).Text & ListView1.ListItems(i).ListSubItems(1).Text
.Find a, , adSearchForward
SQL = "INSERT INTO [NOTE](DOC_NO,DOC_SUBNO,AID,QTY,RATE,TOTAL_AMNT,DOC_TYPE,DOC_DATE,REMARK,LOC_ID,SUP_ID) " & _
" VALUES(" & ListView1.ListItems(i).Text & ListView1.ListItems(i).ListSubItems(1).Text & "," & ListView1.ListItems(i).ListSubItems(1).Text & "," & _
"" & ListView1.ListItems(i).ListSubItems(2).Text & "," & ListView1.ListItems(i).ListSubItems(5).Text & "," & _
" " & ListView1.ListItems(i).ListSubItems(6).Text & "," & ListView1.ListItems(i).ListSubItems(7).Text & "," & _
" 'DEBIT','" & DTPicker2.Value & "','" & Text2.Text & "'," & _
" " & Combo4.ItemData(Combo4.ListIndex) & "," & Combo5.ItemData(Combo5.ListIndex) & ")"
Set RS = CON.Execute(SQL)
Next
End If
End Sub
This code adds data from ctrl's to listview but at the last position(after all already shown records in listview)....
When I click save button,it starts saving records from top position(which records are already exist in database)
So I want to save the currently added record present at last position in listview...
datz y I coded for <.find>,it's records in listview n again saves existing rec with different autonumber.......
I want to skip the existing rec n save only those whose doc_no+doc_subno are new....
plz help me....