?
Solved

exporting to excel through crviewr

Posted on 2003-03-30
6
Medium Priority
?
259 Views
Last Modified: 2011-09-20
hi i hope this is an easy one I am using crystal 8.5 and vb 6.0 using a crviewer in vb 6.0 i am exporting to excel.

This works fine except there are no column headings. Yet here are when i open the report in crystal and export.

Is there there a quick way to get the column headings
0
Comment
Question by:davoman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 8235036
How are you exporting the data from VB?  What is the code?

mlmcc
0
 
LVL 1

Author Comment

by:davoman
ID: 8235083
Public Sub ShowReportsExcel(ByVal strquery As String, strpath As String, strOutput As String)
On Error GoTo Error_check

Dim CRVAppl As CRAXDRT.Application
Dim CRReport As CRAXDRT.Report
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Set CRReport = Nothing


Set CRVAppl = New CRAXDRT.Application
Set CRReport = CRVAppl.OpenReport(strpath)
CRReport.DiscardSavedData


cn.ConnectionString = "Provider = SQLOLEDB;Integrated Security=SSPI;Persist Security Info=False;User ID=sa;" & _
                        "Data Source=Server1;" & _
                        "Initial Catalog=FordContact"
cn.Open
rs.Open strquery, cn, adOpenKeyset
CRReport.Database.SetDataSource rs


Screen.MousePointer = vbHourglass
CRReport.ExportOptions.DestinationType = crEDTDiskFile
CRReport.ExportOptions.FormatType = crEFTExcel80
CRReport.ExportOptions.FormatType = crEFTExcel80Tabular


CRReport.ExportOptions.DiskFileName = "c:\my documents\" & strOutput
CRReport.Export False




Screen.MousePointer = vbDefault
MsgBox "Your report has been exported to c:\my documents\" & strOutput
Else
    MsgBox "There were no records to show or the report could not be created"
    Exit Sub
End If

Error_out:
Exit Sub

Error_check:

MsgBox "There has been and error. Please see the system administrator" & vbCr & vbCr & Err.Number & vbCr & Err.Description
Resume Error_out
End Sub

The code created with the help of your good self mimcc :)
0
 
LVL 1

Author Comment

by:davoman
ID: 8235089
rs.Open strquery, cn, adOpenKeyset

If rs.RecordCount > 0 Then
CRReport.Database.SetDataSource rs

sorry missed a bit

0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 101

Accepted Solution

by:
mlmcc earned 400 total points
ID: 8235101
I think this line causes you to export only the data and not the columns headers

CRReport.ExportOptions.FormatType = crEFTExcel80Tabular

Try without that line.

mlmcc
0
 
LVL 1

Author Comment

by:davoman
ID: 8235107
Just the job!! Thanks once again
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 8235460
Glad to help

mlmcc
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question