Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Mar 2004
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Listbox/ADO (2003)

    I am trying to use a listbox (from Excel) to allow someone to make a selection of n columns of data from an Access file. I need the selected data columns to be sent to a csv file and I would like to use ADO to do this. Creating the listbox and the associated filename list is not a problem. However, I am not sure how to associated the filenames with their corresponding names in the Access file and then pull only those data columns from the file. Any suggestions?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Listbox/ADO (2003)

    Do you really mean filenames, or do you mean field names?

  3. #3
    2 Star Lounger
    Join Date
    Mar 2004
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Listbox/ADO (2003)

    Yes, you are right-field names.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Listbox/ADO (2003)

    Thanks. Next question: what kind of list box do you use?
    1. A list box on a worksheet, created from the Forms toolbar.
    2. A list box on a worksheet, created from the Control ToolBox.
    3. A list box on a UserForm, created in the Visual Basic Editor.

  5. #5
    2 Star Lounger
    Join Date
    Mar 2004
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Listbox/ADO (2003)

    I'm using a list box on a Userform created in the VB editor. Thanks.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Listbox/ADO (2003)

    See if you can adapt the code behind the userform in the attached workbook to suit your purpose.

  7. #7
    2 Star Lounger
    Join Date
    Mar 2004
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Listbox/ADO (2003)

    Yes!! Works great. Thanks.

    This seems to be the logic I was missing:

    strSQL = strSQL & ", [" & Me.ListBox2.List(i) & "]"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •