Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Piscataway, New Jersey, USA
    Posts
    171
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Docmd.Outputtto fields missing (Access 2000 / XP)

    Hi everybody:

    I have a production app that generates Access reports and then allows users to export them to Excel, using Docmd.outputto. It's worked fine for a couple of years, but this week a user tried it and found that some of the fields from the detail section were missing in Excel. This only seems to affect reports when the first few records don't have any data in those fields. It's a simple report, with one group header and footer, very little code, and no calculated fields.

    I'm using outputto instead of transferspreadsheet so that subreport data will be included.

    This only happens when the report is open in print preview, not once it is closed. Natch, the users want to keep it visible while exporting it.

    Any ideas?

    Thanks, in advance, for your help.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Docmd.Outputtto fields missing (Access 2000 / XP)

    I cannot reproduce the problem. Could you post a stripped down copy of your database? See <post#=401925>post 401925</post#> for instructions.

  3. #3
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Piscataway, New Jersey, USA
    Posts
    171
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Docmd.Outputtto fields missing (Access 2000 / XP)

    That would be difficult, because all the information is confidential. Here's the menu bar button code:

    Function fnExportXL()
    Dim intRpt As Integer, strReport As String
    strReport = fnGetReport()
    If strReport = "" Then
    Exit Function
    Else
    On Error Resume Next '(in case user cancels)
    DoCmd.OutputTo acOutputReport, strReport, acFormatXLS, , True
    End If

    End Function

    The code to produce the report is much more complicated, but at the end, it's just:

    DoCmd.OpenReport "rptBalAll", acViewPreview

    The fields that are missing are from the report's query, same names in their text box controls on the report's Detail section.

    Does this help?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Docmd.Outputtto fields missing (Access 2000 / XP)

    Sorry, no. Since the problem doesn't occur if the report is closed, you could create code that closes the report, exports it, and if desired, reopens the report in preview mode,

  5. #5
    2 Star Lounger
    Join Date
    Feb 2003
    Location
    Piscataway, New Jersey, USA
    Posts
    171
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Docmd.Outputtto fields missing (Access 2000 / XP)

    Thanks for the idea. It's clunky, but it works.

    If you think of any reason why the fields are missing otherwise, please let me know.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Docmd.Outputtto fields missing (Access 2000 / XP)

    Not without seeing (a copy of) the database <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>

Posting Permissions

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