A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Inserting items in table from selections in listbox



 
 
Thread Tools Display Modes
  #1  
Old January 9th, 2008, 07:47 PM posted to microsoft.public.access.forms
[email protected]
external usenet poster
 
Posts: 17
Default Inserting items in table from selections in listbox

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!
  #2  
Old January 9th, 2008, 08:14 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default Inserting items in table from selections in listbox

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.
--
Dave Hargis, Microsoft Access MVP


" wrote:

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!

  #3  
Old January 9th, 2008, 09:04 PM posted to microsoft.public.access.forms
[email protected]
external usenet poster
 
Posts: 17
Default Inserting items in table from selections in listbox

On Jan 9, 3:14*pm, Klatuu wrote:
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.
--
Dave Hargis, Microsoft Access MVP



" wrote:
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!- Hide quoted text -


- 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?
  #4  
Old January 9th, 2008, 09:49 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default Inserting items in table from selections in listbox

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.
--
Dave Hargis, Microsoft Access MVP


" wrote:

On Jan 9, 3:14 pm, Klatuu wrote:
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.
--
Dave Hargis, Microsoft Access MVP



" wrote:
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!- Hide quoted text -


- 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?

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:09 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.