Movian
02-25-2011, 10:29 AM
Hey,
I have a listbox that displays a user editable list of options taken from a table. I have this code as part of a delete function no this works find when there is text in the value field for the record. However if the value field is an empty string or null it is unable to locate the record to delete.
Any suggestions ?
For Each varItm In Me.DropList.ItemsSelected
myrs.Open "SELECT * FROM tblLookupValues WHERE Form1 = '" & txtForm & "' AND Control = '" & txtControl & "' AND Value = '" & Me.DropList.ItemData(varItm) & "'", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
MsgBox myrs.RecordCount
myrs.delete
myrs.Close
Next
As usual any help is appreciated.
I have a listbox that displays a user editable list of options taken from a table. I have this code as part of a delete function no this works find when there is text in the value field for the record. However if the value field is an empty string or null it is unable to locate the record to delete.
Any suggestions ?
For Each varItm In Me.DropList.ItemsSelected
myrs.Open "SELECT * FROM tblLookupValues WHERE Form1 = '" & txtForm & "' AND Control = '" & txtControl & "' AND Value = '" & Me.DropList.ItemData(varItm) & "'", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
MsgBox myrs.RecordCount
myrs.delete
myrs.Close
Next
As usual any help is appreciated.