Append query based on multiselected listbox

  • Thread starter Thread starter CJA
  • Start date Start date
C

CJA

Hi,

I have a listbox with 4 columns and with the multiple selection option
active. i want select some listbox records and append them to a table.
I´ve tried many aproaches without success.

Thanks

CJA
 
Here is an example of some code that runs an update query
based on each item selected in a list box. You'll need to modify it to
work in your app.

Dim varItem As Variant
Dim strSQL As String
Dim con As ADODB.Connection
Set con = CurrentProject.Connection

For Each varItem In Me.lstBox.ItemsSelected

strSQL = "update SomeTable set SomeField = " & Me.ControlName _
& " where SomeID = " & Me.lstBox.Column(0, varItem)

con.Execute strSQL

Next varItem

con.Close
 
Back
Top