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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|