Access 2007 Runtime - Export Report



I would like to be able to export reports from an Access 2007 program in
The Report Preview Ribbon doesn't have the Export group on it.
I created a custom Ribbon and it worked fine until I ran the program in
runtime mode. The Export tab was blank again.
I have tried using TransferSpreadsheet, but I have many reports that the
user chooses filters for and I open the report with a 'Where' clause. The
TransferSpreadsheet only transfers the underlying query, not with the filters.
The Export Button works perfectly for this but is missing in the runtime.
Is there a way to filter Data in TransferSpreadsheet, or a way to put the
Export button on a Ribbon in a runtime?

Mark Andrews



Thank you so much for this information.
I downloaded the Ribbon example db.
Then I copied the xml to my USysRibbon table.
I included this ribbon name on the report properties.
When I open the report using the runtime, the Export buttons come up which
is exactly what I wanted.
But when I click on the 'Export to Excel' button I get a message:
"The expression you entered has a function name that Microsoft Access can't
I don't know where to start looking for the error.
My report exports fine when I'm not using the runtime, and I tried Mr.
Kallal's report on his example db and it worked fine.
Any ideas?

Mark Andrews

Did you put the code in? There is a little bit of VBA code that goes with
those buttons.
It's probably in the basRibbonCallbacks module.

I think this is the code:
Public Function MyExport(strFormat As String)

Dim strFileType As String
Dim strFileFilter As String
Dim strFilename As String

Select Case strFormat

Case "RTF" ' word
strFileType = acFormatRTF
strFileFilter = "*.rtf"

Case "XLS" ' excel
strFileType = acFormatXLS
strFileFilter = "*.XLS"

Case "TXT" ' text
strFileType = acFormatTXT
strFileFilter = "*.txt"

Case "HTML"
strFileType = acFormatHTML
strFileFilter = "*.html"

Case "PDF"
strFileType = acFormatPDF
strFileFilter = "*.pdf"

Case Else
Exit Function

End Select

strFilename = SaveFileName(strFileType, strFileType, strFileFilter)

If strFilename <> "" Then
DoCmd.OutputTo acOutputReport, Screen.ActiveReport.Name, strFileType,
End If

End Function

Public Function SaveFileName(strTitle As String, strFilterText As String,
strFilter As String) As String

strFilter = ahtAddFilterItem(strFilter, strFilterText, strFilter)
SaveFileName = ahtCommonFileOpenSave( _
OpenFile:=False, _
Filter:=strFilter, _
DialogTitle:=strTitle, _
End Function

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question