Results 1 to 7 of 7
  1. #1
    Callahan is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    25

    acFormatXLS not working

    With Access 2010, has anyone ever tried to export a form to Excel using


    a VB command like:

    DoCmd.OutputTo acForm, My.[FrmNam], acFormatXLS, xlsnam, False, "", -1

    My result is a spreadsheet with field names, but no data. Wonder what the funny fix will be. Could be like the one I found for a problem sending form filters to a report. The solution (found by accident) was to close the report before opening it. That's closing an unopened report. Funny, but it works.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    to my knowledge you can't export a form, you can export the contents that the form is displaying though, just reference the query driving the form as the source for the export.

  3. #3
    Callahan is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    25
    Yes you can export the contents of a form, and that's what I'm trying to do. It worked with good ol Access 2003.

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    I think that's exactly what I said, exporting the contents, not the form itself.

  5. #5
    Callahan is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    25
    Yes, that is exactly what I'm trying to do. Go ahead, open a form, then right click on it's name in the object window and export it to Excel, you get a better looking spreadsheet from a form than you do from a query. Queries are not the answer to ever thang. I need to know why the heck the acFormatXLS is not working!!

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    This worked, in button click on form to export:
    DoCmd.OutputTo acOutputForm, Me.Name, acFormatXLS, "C:\Test1.xls", False, "", -1

    It only exports data from bound controls.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Callahan is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    25
    Well, maybe you are correct, that queries are the ticket. I changed my DoCmd to use the query that the form uses, and by the buh-boogidy-wuh-woogidy, it worked.

    Funny!!! Thanks again rpearle

Please reply to this thread with any new information or opinions.

Similar Threads

  1. IsNull not working...
    By Moekandu in forum Programming
    Replies: 3
    Last Post: 01-29-2011, 06:48 PM
  2. Grouping not working
    By jgelpi16 in forum Reports
    Replies: 3
    Last Post: 08-24-2010, 11:50 AM
  3. Working with PDF's
    By Mitch87 in forum Access
    Replies: 1
    Last Post: 02-19-2010, 11:24 AM
  4. Checkbox not working
    By terryvanduzee in forum Programming
    Replies: 4
    Last Post: 10-23-2009, 10:36 AM
  5. Why isn't this working?
    By adiecidue in forum Queries
    Replies: 4
    Last Post: 04-27-2009, 10:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums