Delet a record when item is removed from a list view
Hi There, hope you can help!
In my application I have a listbox listing select criteria with the following code -
(VB Code -
adoExpertise.Open "select * from tblExpertise INNER JOIN tblExpertiseRequirements ON tblExpertise.bytExpertiseCode = tblExpertiseRequirements.bytExpertiseCode where tblexpertiserequirements.lngVacancyID =" & FrmVacancy.txtFields(0).Text, db, adOpenStatic, adLockOptimistic
List2.Clear
Max = adosecondary.RecordCount
adoExpertise.MoveFirst
List2.Clear
For i = 1 To Max
List2.AddItem adosecondary!chrExpertise
adoExpertise.MoveNext
Next i
end code)
My problem is how to delete the selected item from the recordset when the item is removed from the list box by the user - Can anybody hep?
Thanks in advance
- PB
Sorry just one more thing
the table tblExpertiserequirements will contain the record that will require deleting
- the tblExpertiserequirements table contains the following -
lngVacancyID and bytExpertiseCode.
So i am thinking we will have to open a recordset with the following sql statement =
select * from tblexpertiserequirements inner join tblexpertise on tblexpertise.bytexpertisecode where where lngVacancyid = "& frmvacancy.txtfields(0).text and tblexpertise.chrExpertise = list2.selected
.delete
then delete the record
tried this and got syntax error!
Hi There
tried to use the sql statement below and got syntax error in where statement
dim i as integer
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open "select * from tblExpertiseRequirements inner join tblExpertise on tblexpertise.bytexpertisecode where tblexpertise.chrexpertise =" & List2.Selected(i), db, adOpenStatic, adLockOptimistic
if i dont use i as integer i get argument not optional error