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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jonnycakes
    New Member
    • Jan 2012
    • 24

    #1

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

    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 "tblAlignme nt".
    • 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||Leade r||Manager||Tim eStamp|
    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
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32669

    #2
    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.

    Comment

    • jonnycakes
      New Member
      • Jan 2012
      • 24

      #3
      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.
      Last edited by jonnycakes; Feb 2 '12, 07:27 AM. Reason: Incomplete

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32669

        #4
        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.

        Comment

        Working...