Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2004
    Location
    Atlanta, GA
    Posts
    62

    Unanswered: button to export table to xls?

    Hello all,
    i've made a form with a combo that has all the tables listed called "what_table"
    I have a button linked to a macro running an "output to" command.
    In the object name field i did " Form!export!what_table "
    this didn't work.
    How do i get the value (Table) from the combo into the object field.
    Or if this is totaly barking up the wrong tree, how can i do this ???
    Also, i'd like to put a button on here that backs up the entire DB.
    I'm VERY new to VB (hense the macro) but am in the process of learning.

    Any help would be great
    Thanks
    Brownie

  2. #2
    Join Date
    Sep 2004
    Location
    Atlanta, GA
    Posts
    62
    Anyone? please...

  3. #3
    Join Date
    Feb 2005
    Posts
    19
    Can you write code ? If so then select the After Update event from the combo box and tell it : me!ObjectField=me!Combo

    However if you are trying to get that table to export to .xls then you will need to put under your button something like:
    DoCmd.OutputTo acOutputTable, me!Combo, acFormatXLS, "SpreadsheetName.xls", True

    If its any other combination then check out OutputTo in the help file.

  4. #4
    Join Date
    Feb 2005
    Location
    England.
    Posts
    232
    There are several ways.

    May I suggest initially putting a button onto the form that has this code beneath it ...

    DoCmd.OutputTo acOutputTable, what_table.value, "MicrosoftExcel(*.xls)", ("{Path you wish to export to}"), False, ""

    1 coveat I'd like to make. I don;t often use combo lists and from what I can remeber the .value is the name listed in the combo box. If this isn;t the case then cahnge .value to .{something} where the something is the test

    You can then test this to your heart's content. Then once this is working start looking at the properties of combo boxes and work out what's best for you.

    You may also wish to consider testing to make sure that something has been selected from the combo list.

    Hope this helps.

  5. #5
    Join Date
    Sep 2004
    Location
    Atlanta, GA
    Posts
    62
    Dave and Jlc, thanks for responding. WIll try later today and let you know.
    Brownie

Posting Permissions

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