Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    May 2002
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    List Box to Excel (97)

    Is there any way to export the data in a list box to excel? Nothing tricky required, it's just that for some reason when I cut the listbox data (populated via a combo box dropdown selection) then try to paste in excel, I only pick up the first column of data. I'm thinking maybe a list box properties setting. I'm trying to avoid VB here, since I'm not too strong there, trying to keep it as gui and simple as possible.

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

    Re: List Box to Excel (97)

    I take it that the RowSource of the list box is a query that uses the combo box selection as criteria.

    If there is a SQL statement in the RowSource property, create a saved query with that SQL statement.

    You can export the query to Excel. It will contain all columns.

  3. #3
    Lounger
    Join Date
    May 2002
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: List Box to Excel (97)

    You are correct, the Rowsource has SQL, a variable is the combobox.value. When I create a query with this SQL, I am prompted for the combobox.value. So the variable in the SQL is not tied to the combobox value. Am I missing something?

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

    Re: List Box to Excel (97)

    You can do two things:

    Either

    Type in the combo box value when you open the query. You have to know the appropriate value, of course.

    or

    Open the form and select the appropriate value in the combo box.
    Now activate the database window (F11) (don't close the form!) and open the query. It should get the value from the form now instead of prompting you.

    For a more convenient solution, you would need VBA I'm afraid...

  5. #5
    Lounger
    Join Date
    May 2002
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: List Box to Excel (97)

    It worked!! There are two real solutions, however, since this is a little inconvenient for user. The first is to do it in VBA, the second would be to create an analogous query with a command button where the user is prompted for the variable now supplied by the combobox. I'm going to wait for prototype meeting next week to decide which way to go, if at all.
    Thanks for your help.
    <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

Posting Permissions

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