Sending multiple selections from a 'drop down' list in a Form to an append query

videozvideoz

Board Regular
Joined
Apr 1, 2011
Messages
51
In Access I have a form with a drop-down list. I have set the form to 'multiple select' so I can select more than 1 item at once. At the end of the form is a button that runs an append query. How do I get an 'append query' to insert all the items I have selected? If I have a drop-down that only allows me to select 1 item it works fine, but when doing multiple selections it just returns a blank. Screenshot below to show multiple selection. Thanks

screenshot-1.jpg
 
Last edited:

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Hi hopefully this is what yo uare looking for...

Option Compare Database
Option Explicit

Private Sub Command0_Click()
Dim myItem

For Each myItem In Me.List1.ItemsSelected

DoCmd.SetWarnings False

DoCmd.RunSQL "INSERT INTO Table1 ( Field1 )SELECT '" & Me.List1.ItemData(myItem) & "' AS Field1;"

DoCmd.SetWarnings True

Next myItem

End Sub


cheers

Matt
 
Upvote 0
Thanks Matt. Sorry for being a little bit thick, but i don't know VBA. Which parts of the code so I need to replace with my identifiers?
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top