' aqui um exeplo de como chamos os meus uso a versão 9 mas é compartivel com as mais novas
Public crxApp As CRAXDRT.Application
Public crxRpt As CRAXDRT.Report
Sub Print_relatorio(sReport$, strSQL$)
Dim ADOrst As ADODB.Recordset
Dim strProvider$
Dim I%
Dim LcRPT$
Screen.MousePointer = 11
LcRPT = Parametros.strlocalRelat & "elatorios" & sReport
Set crxApp = New CRAXDRT.Application
Debug.Print LcRPT
Debug.Print strSQL
Set crxApp = CreateObject("crystalruntime.application")
Set crxRpt = crxApp.OpenReport(LcRPT)
Dim Tabela As CRAXDRT.DatabaseTable
Dim Propriedades As CRAXDRT.ConnectionProperties
Screen.MousePointer = vbHourglass
Frm_CRPT.CRViewer9.ReportSource = crxRpt
Set ADOrst = New ADODB.Recordset
ADOrst.Open strSQL, Conexao, adOpenDynamic
DoEvents
For Each Tabela In crxRpt.Database.Tables
Set Propriedades = Tabela.ConnectionProperties
'strProvider = Conexao.Provider
Propriedades.DeleteAll
' Propriedades.Add "Provider", Conexao.Provider
Propriedades.Add "DSN", DSNName
Propriedades.Add "data source", ADOrst.DataSource
Next
crxRpt.Database.SetDataSource ADOrst
crxRpt.ReadRecords
crxRpt.PaperSize = crDefaultPaperSize
For I = 1 To crxRpt.FormulaFields.Count
If crxRpt.FormulaFields(I).FormulaFieldName = "Formula_Data" Then
' crxRpt.FormulaFields(I).Text = Chr(34) & Variavel_Data & Chr(34)
ElseIf crxRpt.FormulaFields(I).FormulaFieldName = "Formula_Vendedor" Then
' crxRpt.FormulaFields(I).Text = Chr(34) & "Kleisson" & Chr(34)
ElseIf crxRpt.FormulaFields(I).FormulaFieldName = "Formula_Conta" Then
' crxRpt.FormulaFields(I).Text = Chr(34) & "Conta: " & Cmb_Contas.Text & Chr(34)
ElseIf crxRpt.FormulaFields(I).FormulaFieldName = "Formula_Cliente" Then
' crxRpt.FormulaFields(I).Text = Chr(34) & "Cliente: " & Txt_Cliente.Text & Chr(34)
ElseIf crxRpt.FormulaFields(I).FormulaFieldName = "Formula_Representante" Then
' crxRpt.FormulaFields(I).Text = Chr(34) & "Representante: " & txt_representante.Text & Chr(34)
End If
Next I
Frm_CRPT.CRViewer9.DisplayGroupTree = False
Frm_CRPT.CRViewer9.DisplayTabs = False
Frm_CRPT.CRViewer9.DisplayToolbar = True
Frm_CRPT.CRViewer9.EnablePrintButton = True
Frm_CRPT.CRViewer9.EnableExportButton = True
Frm_CRPT.CRViewer9.ViewReport
DoEvents
Frm_CRPT.CRViewer9.Refresh
Screen.MousePointer = vbDefault
Frm_CRPT.Caption = "Relatório de Impressão"
Frm_CRPT.Show
Screen.MousePointer = 0
Set Propriedades = Nothing
Set Tabela = Nothing
'Set crxRpt = Nothing
End Sub