By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,847 Members | 2,292 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,847 IT Pros & Developers. It's quick & easy.

Listbox(MultiSelect: Simple) vba to save each selection individually

jonnycakes
P: 24
Hello Everyone,

I am very new to access and i'm limited at work with Access 2000. I stumbled accross a post(http://bytes.com/topic/access/answer...x-items-string) on this website that came very close to what i'm looking to accomplish and after hours of trial and error i've come here to seek guidance.

here's my setup:
  • Combobox named LeaderInput
    Row Source: qLeader (Pulls the name of every Leader from a seperate table)
    Control Source: LeaderInput saves to a different table named "tblAlignment"(This table is used for trending current alignments).
  • Listbox named ManagerInput; MultiSelect set to Simple
    Row Source: qManager (Pulls all the name of every manager from a seperate table)
    Control Source: ManagerInput saves to a different table named "tblAlignment".
  • textbox named TimeStamp which has default value set to =now()

I am trying to get each selection from the listbox to save seperately. Meaning if i select any single Leader from the combobox and then select Manager 1, Manager 2, Manager 3, etc. i would like the vba to save it to a table in this format:

|AutoNum||Leader||Manager||TimeStamp|
1 Schmitz, Jon Romo, Tony Date/Time
2 Schmitz, Jon Brees, Drew Date/Time
3 Schmitz, Jon Manning, Peyton Date/Time

I have attached a sample of this portion of my database. I greatly appreciate your time and thank you in advance for any support.
Attached Files
File Type: zip Database2.zip (48.1 KB, 114 views)
Jan 28 '12 #1

✓ answered by NeoPa

Nicely presented question Jonny :-)

There is nothing intrinsic (that I know of) that allows you to present multiple records of literal values into a table. I suspect then, that you'll need to process through your list using a loop in code. How you handle adding individual records is up to you. A SQL command could do it, or records could be added to a recordset within the loop. Your choice, but I'm confident this will need to be incorporated into the loop in your code that processes through the data values selected.

Share this Question
Share on Google+
3 Replies


NeoPa
Expert Mod 15k+
P: 31,307
Nicely presented question Jonny :-)

There is nothing intrinsic (that I know of) that allows you to present multiple records of literal values into a table. I suspect then, that you'll need to process through your list using a loop in code. How you handle adding individual records is up to you. A SQL command could do it, or records could be added to a recordset within the loop. Your choice, but I'm confident this will need to be incorporated into the loop in your code that processes through the data values selected.
Jan 28 '12 #2

jonnycakes
P: 24
NeoPa, I like your style, you gave just enough to motivate me to keep going. Thanks for your help.

::Edit:: I will be back this week to post the code that i'm using; for those that may find it useful.
Feb 2 '12 #3

NeoPa
Expert Mod 15k+
P: 31,307
Your good question made a framework into which I could reply appropriately.

If further, more detailed, assistance may prove helpful then feel free to expand it to include what you need.
Feb 2 '12 #4

Post your reply

Sign in to post your reply or Sign up for a free account.