Hi all,
I currently am using a set of cascading comboboxes that do wonderful at filtering down the data in my unbound listbox. I am at the point now though that I want to take the selected records and when they are highlighted, by pressing an update button, update an existing table with the records.
My listbox is named lsttaxonomyno, update button is called cmdupdate, and the table is called record.
Any suggestions on what to do differently or how to fix my code would be greatly appreciated.
My current code at the moment is as follows:
Private Sub cmdUpdate_click()
Dim intlistcount
Dim intx As Integer
Dim strsql As String
intlistcount = Me!lstTaxonomyno.ListCount
For intx = 0 To intlistcount
If Me!lstTaxonomyno.Selected(intx) Then
If strsql & "" = "" Then
strsql = "(qrytaxonomyno.taxonomyno)='" & Me!lstTaxonomyno.ItemData(intx) & "' "
Else
strsql = strsql & " or " & "(qrytaxonomyno.taxonomyno)='" & Me!lstTaxonomyno.ItemData(intx) & "' " '
End If
End If
Next intx
If strsql & "" = "" Then
MsgBox "No criteria selected, all records will be displayed", vbInformation, "System Message..."
strsql = "update Me.records set taxonomyno = " _
& " Where taxonomyno = " & Me.lstTaxonomyno.Column(0, intx)
Else
strsql = "update Me.records qrytaxonomyno.taxonomyno from qrytaxonomyno Where ((" & strsql & "));"
End If
Me!cnttaxonomyno.Form.RecordSource = strsql
End Sub
Thanks.