Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2003
    Posts
    39

    Unanswered: Exporting to Excel and adding a Date to File

    I need to download a query everyday into a specific file directory. I want to be able to click a button and download the Excel file to a folder and name it: TEST_mmddyyyy.

    I tried the DoCmd.TransferSpreadsheet...,"Test_"&Date() but I think the file already has to exist to use this function.

    Am I doing something wrong or can anyone help me out with this?

    Any help would be greatly appreciated!!!

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Just try


    DoCmd.OutputTo acOutputTable, TableName & txt_PartExportTable_Suffix, acFormatXLS, txt_PartExport_Path & txt_PartExport_fName & txt_PartExportTable_Suffix & Date() & ".xls"



    Good luck

  3. #3
    Join Date
    Aug 2003
    Posts
    39
    I dont think I am doing it correctly and I'm not that great at VB.

    Say my table is: Test
    My directory is just: C:\
    And my suffix is: Date()

    Can some one help me out with the actual code?

    Sorry

    Thanks for your help!

  4. #4
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Wink

    Say my table is: Test
    My directory is just: C:\
    And my suffix is: Date()

    Can some one help me out with the actual code?

    Sorry

    Thanks for your help!

    DoCmd.OutputTo acOutputTable, "Test", acFormatXLS, "C:\output_" & Date() & ".xls"

  5. #5
    Join Date
    Aug 2003
    Posts
    39
    DoCmd.OutputTo acOutputTable, "Test", acFormatXLS, "C:\output_" & Date() & ".xls"


    I used this exact code and got a runtime error 2302: Microsoft Access can't save the output data to the file you've selected.

    Any ideas?

Posting Permissions

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