Populate table from multi select list box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to create an Order form where I can select multiple Products
from a list box all at once. Then hit a button called "Place Order" and have
it populate a Order table with a seperate record for each Product selected
all containing the same OrderID.
 
Here are some general guidelines to help you with that.
To find which products have been ordered, you can loop through the
ItemsSelected collection of the list box. It will contain one entry for each
selected product.

As you do the loop, you can either use SQL or VBA code with a recordset to
insert a record for each selected product. Here is the basic logic structure:

Dim ctl As Control

Set ctl = Me.MyListBox Name
With ctl
For Each varItem In .ItemsSelected
'Here is where you would either create new records in a record set, or build
an SQL string to insert the record in your table.
.ItemData(varItem) 'Will contain a Product that was selected.
Next varItem
End With
 
Thanks, Klatuu,
This is a bit advanced for me, but I soon hope to be able to comprehend it.
I just finished reading Access 2003 Step by Step and am about 100 pages in
Inside Out. I will try to use the code you provided as soon as I'm better up
to speed.
 
Back
Top