Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
|
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 20th, 2003, 07:02 AM
Registered User
 
Join Date: Oct 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Export to Many files using VB6 and CR8.5

I have a report that is grouped by client, on each GH1 an email address appears, I need to be able to export out of crystal reports to seperate files where a new GH starts and email to each client there specific report.

Does anybody know whether this is possible

 
Old October 28th, 2003, 04:39 AM
Registered User
 
Join Date: Oct 2003
Posts: 1
Thanks: 0
Thanked 1 Time in 1 Post
Default




'Option Explicit
Dim crxReport As CRAXDRT.Report
Dim crxApplication As New CRAXDRT.Application
Public X As Integer
'Public crxApplication As CRAXDRT. Object
'Public crxReport As Object
Public crxDatabase As CRAXDRT.Database
Public crxDatabaseTables As CRAXDRT.DatabaseTables
Public crxDatabaseTable As CRAXDRT.DatabaseTable
Public crxSections As CRAXDRT.Sections
Public crxSection As CRAXDRT.Section
Public crxSubreport As Object
Public crxSubreportObject As CRAXDRT.SubreportObject
Private Sub CmdClose_Click()
Unload Me
End Sub

Private Sub Form_Activate()
Reporting
End Sub

Private Sub Reporting()
Me.Caption = "Report"
'ReportPath = "E:\worldcall inventory system\Crystal Reports\DailyCorporateRechargeTransfer.rpt"
'Screen.MousePointer = vbHourglass
Set crxReport = crxApplication.OpenReport(ReportPath)
crxReport.DiscardSavedData
CRViewer1.ReportSource = crxReport
CRViewer1.ViewReport
CRViewer1.Zoom 100
CRViewer1.EnableExportButton = True
CRViewer1.DisplayTabs = True
Command1_Click
'CRViewer1.CloseView 30
End Sub

Private Sub Form_Resize()
'crxReport.re
Set crxReport = crxApplication.OpenReport(ReportPath)
crxReport.DiscardSavedData
'CRViewer1.Refresh
With CRViewer1
    .Top = 0
    .Left = 0
    .Width = 11775 'Me.ScaleWidth
    .Height = 7215 'Me.ScaleHeight
End With

End Sub




''''''ACTUAL CODE START FROM THERE IF YOU HAVE TO EXPORT THE FILE>>>>>>>>
Private Sub Command1_Click()

Dim mReportDir, mExportDir, mReportName, mExportType As String
Dim mServerName, mdata, mUserId, mPassword As String


mReportDir = "E:\worldcall inventory system\Crystal Reports\"
mReportName = "FromToCorporateRechargeTransfer.rpt"
mExportDir = "E:\worldcall inventory system\Crystal Reports\"
mExportType = "xls"
mServerName = "dbcon"
mdata = "UserData"
mUserId = "administrator"
mPassword = "s"

   Dim strFile, strTemp, reportFile As String
  Dim count As Integer


  strFile = "FromToCorporateRecharge.rpt" 'Dir(mReportDir)
'-------------------------------------------------------------------

'Do
   reportFile = "oneFromToCorporateRecharge.rpt"
'-------------------------------------------------------------------

   Set crxReport = crxApplication.OpenReport(mReportDir & strFile)
   crxReport.DiscardSavedData

   Set crxDatabase = crxReport.Database

   Set crxDatabaseTables = crxDatabase.Tables

   count = 1
   For Each crxDatabaseTable In crxDatabaseTables
       crxDatabaseTable.SetLogOnInfo mServerName, mdata, mUserId, mPassword
       count = count + 1
   Next crxDatabaseTable


   Set crxSections = crxReport.Sections

   For Each crxSection In crxSections

       For X = 1 To crxSection.ReportObjects.count

  If crxSection.ReportObjects(X).Kind = crSubreportObject Then

   Set crxSubreportObject = crxSection.ReportObjects(X)
  Set crxSubreport = crxSubreportObject.OpenSubreport
  Set crxDatabase = crxSubreport.Database
  Set crxDatabaseTables = crxDatabase.Tables


  count = 0
  For Each crxDatabaseTable In crxDatabaseTables
       crxDatabaseTable.SetLogOnInfo mServerName, mdata, mUserId, mPassword
       count = count + 1
  Next crxDatabaseTable

 End If

 Next X

Next crxSection

   crxReport.ExportOptions.Reset
'----------------------------------------------------------------
   If (mExportType = "pdf") Or (mExportType = "PDF") Then
   crxReport.ExportOptions.FormatType = crEFTPortableDocFormat
   'crxReport.ExportOptions. = True
   End If

   If (mExportType = "doc") Or (mExportType = "DOC") Then
   crxReport.ExportOptions.FormatType = crEFTWordForWindows
   End If

   If (mExportType = "xls") Or (mExportType = "XLS") Then
   crxReport.ExportOptions.FormatType = crEFTExcel80
   End If

   If (mExportType = "txt") Or (mExportType = "TXT") Then
   crxReport.ExportOptions.FormatType = crEFTText
   End If

   If (mExportType = "csv") Or (mExportType = "CSV") Then
   crxReport.ExportOptions.FormatType = crEFTCommaSeparatedValues
   End If

   If (mExportType = "rtf") Or (mExportType = "RTF") Then
   crxReport.ExportOptions.FormatType = crEFTExactRichText
   End If
'------------------------------------------------------------------
   crxReport.ExportOptions.DestinationType = crEDTDiskFile

   crxReport.ExportOptions.DiskFileName = (mExportDir & reportFile & "." & mExportType)

   crxReport.ExportOptions.UseReportDateFormat = True

    crxReport.ExportOptions.UseReportNumberFormat = True

    crxReport.Export (False)
'-------------------------------------------------------------------
strTemp = strTemp & strFile

'strFile = Dir
'Loop Until strFile = vbNullString


MsgBox "Success: - Export Complete"

End Sub
The Following User Says Thank You to imran64 For This Useful Post:





Similar Threads
Thread Thread Starter Forum Replies Last Post
crystal report export using vb6 mycha_2003 Pro VB Databases 1 March 29th, 2016 03:04 AM
export excel files collie ASP.NET 1.x and 2.0 Application Design 2 January 3rd, 2008 09:09 AM
Export the data from datagrid to excel in VB6 Sharad Singh Beginning VB 6 1 April 16th, 2007 06:00 AM
CR8.5 PRB: SetText and Export Excel cwtseng Crystal Reports 0 August 24th, 2006 09:07 AM
Export Messages from Outlook Express using VB6 ANVAR VB How-To 0 April 13th, 2005 06:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.