Append query based on multiselected listbox

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
 
B

Beetle

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top