Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2009
    Posts
    2

    [Solved]Transferspreadsheet using textbox values in file name problem

    This is probably a very simple question however I've looked all over and can't seam to get this small statement to work correctly.

    -Setup / Background Information-
    I have a form that enters records about items into a table using a query. The query feeds into a listbox that updates and shows what records are in the query. I also have a textbox+button that you can type anything it and it will search any of the fields in the query and it will filter the query and display it in the list box. Under that there is a "export to excel" button which I have it open a new small popup window which allows you to select a filepath from a combo box.

    -The problem-
    The exporting form gathers information from the main record entering form and builds a file name and exports using docmd.transferspreadsheet. It worked fine until I tried to add 2 textbox values to the file name.



    loc = Nz(filepath, "C:\")

    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, Forms![tracking form]!lstRecordSearch.RowSource, _
    loc & [Forms]![tracking form]![DFrom] & [Forms]![tracking form]![DTo] & ".xls", True, ""
    DFrom = Date From which is an unbound textbox that is masked for dates (01/01/2009)
    DTo = exact same as DFrom and is just for the To Date

    I hit export with this bound to a button and nothing happens
    Last edited by Automator; 03-25-2009 at 02:20 PM.

  2. #2
    Join Date
    Mar 2009
    Posts
    2
    Well I figured out a way that will suit my needs.

    loc = Nz(filepath, "c:\")

    DoCmd.OutputTo acOutputQuery, "searchq", acFormatXLS, loc & Format(Now(), "MM-DD-YYYY HH-MM") & "-Records.xls"
    Figured I would post this in case anyone comes across this.

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

Similar Threads

  1. Replies: 0
    Last Post: 10-23-2008, 12:08 AM
  2. Can't get TransferSpreadsheet to work
    By Valeda in forum Import/Export Data
    Replies: 0
    Last Post: 07-19-2007, 08:04 AM
  3. Link table using MAC PC file sharing problem
    By TaiYipStreet in forum Access
    Replies: 0
    Last Post: 07-19-2006, 08:02 AM
  4. transferSpreadsheet
    By rabbit in forum Import/Export Data
    Replies: 1
    Last Post: 06-09-2006, 04:01 PM
  5. transferspreadsheet function
    By jeffj in forum Import/Export Data
    Replies: 3
    Last Post: 03-13-2006, 11:59 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