Inserting items in table from selections in listbox

  • Thread starter Thread starter jseger22
  • Start date Start date
J

jseger22

Hi,

I have a listbox (list17) on a form based on a query called
Projects_Select. The query has 6 fields which are displayed in the
listbox as columns and not a set number of rows. The MultiSelect
property is set to Extended. I have a command button (Command106)
that on the OnClick event I want it to make a table in my database
that contains the users selections from the listbox. I can't figure
out how to do this since there are multiple columns in my listbox.
Your help is much appreciated.

Thanks!
 
You will need to use the ItemsSelected collection of the list box to return
the select values. You also have to use the Column property of the list box
to get each value.

See VBA Help on ItemsSelected. There is a good example there of how to do
that.
 
You will need to use the ItemsSelected collection of the list box to return
the select values.  You also have to use the Column property of the listbox
to get each value.

See VBA Help on ItemsSelected.  There is a good example there of how to do
that.
--
Dave Hargis, Microsoft Access MVP







- Show quoted text -

OK, I checked out the example and it makes alot of sense, I guess I am
just not familar with the SQL code needed to insert each column into
the appropriate field. Any suggestions?
 
In a case like this, I would opt for Recordset processing. That is, once I
found a row in the list box, I would assign the value of each column to a
table field. I would not use a make table query (they are inefficient), I
would define a table and use it.

Then you open the table as a recordset, and put the data in.
 
Back
Top