Export to Excel

G

Guest

Hi

I am trying to export data from access to excel. I have used the following
code.

Private Sub Export_Click()
On Error GoTo Err_Export_Click

Dim stDocName As String

stDocName = "Trade Ticket"
DoCmd.OutputTo acReport, stDocName

Exit_Export_Click:
Exit Sub

Err_Export_Click:
MsgBox Err.Description
Resume Exit_Export_Click

End Sub

Trade ticket is the name of the report.

The export is pulling all the fields from the report into Excel. Is it
possible to have only certain fields exported from the report to the excel
document. Also is it possible to set the order in which the fields are
exported.

Thanks for any assistance in advance.
 
R

RobFMS

Is it possible to have only certain fields exported from the report to the
excel
document. Also is it possible to set the order in which the fields are
exported.

Yes. The simple solution would be to create a query (and use that as the
source) of the fields you want to show.

HTH

Rob Mastrostefano

--
FMS Professional Solutions Group
http://www.fmsinc.com/consulting

Software Tools for .NET, SQL Server, Visual Basic & Access
http://www.fmsinc.com
 

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

Top