Multi-Select SQL

  • Thread starter Thread starter DS
  • Start date Start date
D

DS

I'm chosing records from a listbox, If I choose one record. It works
fine. But If I do a Multi-Select then only the last Record I select
gets inserted. How do I make this code accept Multiple Selections?
Thanks
DS

CurrentDb.Execute "Insert into MenuInfo (MenuID,MenuCatID) " & _
"Values(" & Forms!MenuMaker!MenuID & "," &
Me.ListNewSection.Column(1) & ")"
 
You need to loop through the selected items of the listbox. Here's some
ugly psuedocode that might help... sorry it's so ugly.

For Each Variant in Listbox.ItemsSelected (I think it's itemsselected)

'Build SQL by specifying each row ListNewSection.Column(columnyouwant,
Variant)
'Execute

Next
 
David said:
You need to loop through the selected items of the listbox. Here's some
ugly psuedocode that might help... sorry it's so ugly.

For Each Variant in Listbox.ItemsSelected (I think it's itemsselected)

'Build SQL by specifying each row ListNewSection.Column(columnyouwant,
Variant)
'Execute

Next


:
OK, I'll have play around with this...so I guess looping is the answer?
Thanks
DS
 

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

Similar Threads

SQL Not Updating 1
DLookUP 4
INSERT Syntax Problem 2
SQL SubQuery 10
GOTO Record Problem 2
3022 error while run update SQL 1
SQL Not Updateable 14
ListBox Coding Problem: Too few parameters. Expected 1. 5

Back
Top