RE: Export from Access 2007 Report to excel

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



According to http://support.microsoft.com/kb/934833/en-us this functionality
has been disabled by design in Access 2007.

Here's a code snippet of a workaround I use which outputs to a datasheet
that can be copied then pasted into Excel:

Public Function ViewAsSpreadsheet()
On Error GoTo ErrHandler
Dim rptName As String
Dim strSql As String

rptName = Application.CurrentObjectName
strSql = Reports(rptName).RecordSource
If ChkObject("Query", "TempQry") = True Then ' is object defined?
CurrentDb.QueryDefs.Delete "TempQry"
End If
CurrentDb.CreateQueryDef "TempQry", strSql
DoCmd.OpenQuery "TempQry", acViewNormal, acReadOnly

Exit Function
ErrHandler:
......

This gets the query string from the recordsource for the report that is
open, then creates a temporary query using the query string. From there you
can open the query as a datasheet.

"Peter" wrote:

In Access 2003 I could export to an excel file from Report Preview, or by
using the output to macro command, choosing a Report name, and choosing Excel
2003 format.
the file type of output format does not seem to be included in the
equivalent areas in 2007 (unless I export from a table or query, but not from
a report)
--
Thanks 4 Help
.



Relevant Pages

  • Re: Change format of date in query?
    ... listed right in the query. ... Are you viewing the query datasheet itself? ... Instead use a Form or Report. ... formatted string) and ColumnWidths to ...
    (microsoft.public.access.queries)
  • Re: code to auto update a table field when database is loaded
    ... you can write code in its Open or Load event that will run a Query to do ... executes a Query to do what you want. ... If you are allowing the users access to Datasheet view, ... Record Source for the Form or Report -- to return Accepted or Settled if so ...
    (comp.databases.ms-access)
  • Re: More query questions re: keywords
    ... For now I have it opening in datasheet view. ... report off the query & attach the report to a switchboard to make it easy on ... "Duane Hookom" wrote: ...
    (microsoft.public.access.queries)
  • Re: SELECTING SPECIFIC Reports from a DataSheet to be Used in a Report ??
    ... tick specific records they want on the report ... The basics all work well (query, displaying of data, etc). ... part of the criteria used to select records in the datasheet ... When this Form displays (in datasheet fromat)....it would be GREAT if the ...
    (microsoft.public.access.formscoding)
  • RE: table turned to horizontal lines, cant read any of my data
    ... Are you in a table, query, a form in datasheet view, or a report? ... Have you tried shutting off the database and the computer then starting ... Right click on the header of the table or query and select Datasheet ...
    (microsoft.public.access.gettingstarted)