Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2004
    Posts
    48

    Unanswered: Output to Excel different results

    Greetings,

    I am trying to output to excel put it is outputting different results, compared to when I run it in a report

    I have a Select Case. Option1 puts it in a report and Option2 directly to excel.


    Code:
     DoCmd.OutputTo acOutputReport, "rptCust", acFormatXLS, "C:\file.xls"
    I am doing a filter on a date range and a drop down menu. I get the select dates however, I it outputs anything within that date range. When I run the option for a report it works out with no problem?

  2. #2
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    In my experience, you're better off outputting the query (rptcust's record source) instead of the report itself. If you need to filter it, add the filter to the query. I don't know how it'll handle a drop-down menu, however.

    Sam

  3. #3
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    You might also want to try the docmd.transferspreadsheet with the query as the source to export instead of the domcd.output command.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  4. #4
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926

    Sample Browse

    Also, attached is an example of utilizing the browse button to obtain your filename. Just change the OpenFile:=True to OpenFile:=False on the OnClick for the browse button and then change the import to export with your export command.
    Attached Files Attached Files
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

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