Results 1 to 3 of 3
  1. #1
    b.saimsc is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2012
    Posts
    24

    Thumbs up Unable to Export Excel report with Command button


    Hi all,

    I have created report and It's generated manually (Header--External Data--Excel)Perfect. But if I use command button click it's getting error message of "The action or method requires a Table Name argument". I have used the below mentioned formula.

    Private Sub Command18_Click()


    Dim theFilePath As String


    theFilePath = theFilePath & "_" & Format(Date, "yyyy-mm-dd") & ".xlsx"


    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel10, Report1, theFilePath, True


    End Sub

    Can you please help me....

    Thanks in Advance.......

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    You declare variable theFilePath but do not include drive\folder path in the string.

    Also, Report1 needs to be within quote marks, assuming that is the actual name of table or query.

    Think must use OutputTo method in VBA to export report http://msdn.microsoft.com/en-us/library/ff192065.aspx
    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.

  3. #3
    b.saimsc is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2012
    Posts
    24
    Thank you Super Moderator..

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

Similar Threads

  1. command button to export to excel
    By jains in forum Forms
    Replies: 5
    Last Post: 06-30-2015, 06:27 PM
  2. Replies: 3
    Last Post: 11-28-2012, 10:51 PM
  3. Exporting Report to Excel via Command Button
    By need_help12 in forum Import/Export Data
    Replies: 3
    Last Post: 04-24-2012, 03:27 PM
  4. Replies: 0
    Last Post: 03-24-2011, 09:59 AM
  5. Export Command Button in Form
    By jjmartinson in forum Forms
    Replies: 3
    Last Post: 08-25-2009, 01:28 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