Variable de VB6 à CR9

ecranbleu27 Messages postés 190 Date d'inscription vendredi 4 juin 2004 Statut Membre Dernière intervention 29 avril 2009 - 27 mai 2006 à 07:49
ecranbleu27 Messages postés 190 Date d'inscription vendredi 4 juin 2004 Statut Membre Dernière intervention 29 avril 2009 - 28 mai 2006 à 09:21
bjr
je souhaite passer le contenu d'un textbox ("form.textbox.text=x")
dans un état CRYSTAL 9 ("crystalreport1") ,
je suppose qu'il me faut créer un champs parametre ds l'état R9
(nommé : "chpvar" par exemple)
comment dois-je écrire le code ds vb6 pour q'il passe bien cette variable "x"
à "chpvar" .
merci pour votre aide

3 réponses

CODJLT Messages postés 2 Date d'inscription lundi 23 décembre 2002 Statut Membre Dernière intervention 27 mai 2006
27 mai 2006 à 11:05
Bonjour,

pour réussir à paramétrer tout entre VB6 et CR9, j'utilise une "FORM" spéciale qui utilise un CRVIEWER.

Cette feuille peut-être utilisé quelque soit l'édition puisque l'on
rentre le nom du rapport, et peut passer autant de variable que l'on
veut

Voilà le code ssocié à cette feuille

-----------------------------------------------------------------------------------------------------------------

Dim ConnectionInfo As CRAXDRT.ConnectionProperties

Dim passe As Integer


Private Sub Form_Activate()

    
CrxReport.ParameterFields.GetItemByName("Var1").AddCurrentValue
Variable(1) 'Var1 est le nom de la variable dans CR9, Variable(1) celle
dans VB6

     CrxReport.ParameterFields.GetItemByName("Var2").AddCurrentValue Variable(2)

     CrxReport.ParameterFields.GetItemByName("Var3").AddCurrentValue Variable(3)

     CrxReport.ParameterFields.GetItemByName("Var4").AddCurrentValue Variable(4)

     CrxReport.ParameterFields.GetItemByName("Var5").AddCurrentValue Variable(5)

     If Texte <> "" Then

      
CrxReport.ParameterFields.GetItemByName("Titre").AddCurrentValue
Texte  'J'utilise cette ligne pour différencier le titre d'en tête
du rapport

     End If


   If VerEcran = True Then

     CRViewer91.ViewReport 'View the Report.

   Else

     WindowState = vbMinimized

     CrxReport.PrintOutEx

     Unload Me

   End If

End Sub


Private Sub Form_Load()

   On Error Resume Next

   Set CrxReport =
crxApplication.OpenReport(Rapport)                          
' Rapport= nom de l'édition CR9

   Set ConnectionInfo = CrxReport.Database.Tables(1).ConnectionProperties

   ConnectionInfo.Item("database Name") =
FicImpr                                  
'FicImpr = Base utilisée

   CRViewer91.ReportSource = CrxReport 'Sets the Report source of the CrViewer to the Report object we created.

   CRViewer91.Zoom 100

   Screen.MousePointer = vbDefault

End Sub


Private Sub CRViewer91_Clicked(ByVal X As Long, ByVal Y As Long, EventInfo As Variant, UseDefault As Boolean)


Dim CrViewerEventInfo As CRVIEWER9LibCtl.CRVEventInfo 'Create an object that traps the CRViewer event info.

Set CrViewerEventInfo = EventInfo 'Pass the EventInfo info to the CrVEventInfo object.

If Not CrViewerEventInfo.Text = "" Then

    MsgBox CrViewerEventInfo.Text   'If the
event text (or what field was clicked on) is not empty then display it
in a Message Box.

End If

  

End Sub


Private Sub Form_Resize()


 With CRViewer91 ' make the CrViewer control the same size as the Form.

  .Top = 0

  .Left = 0

  .Width = Me.ScaleWidth

  .Height = Me.ScaleHeight

 End With


End Sub


Private Sub CrxReport_NoData(pCancel As Boolean)


 MsgBox "Il n'y a pas de données dans le rapport!"  
'Show Message Box when NoData event from Report object occurs.

 

End Sub


Private Sub Form_Unload(Cancel As Integer)

   Set CrxSubreport = Nothing

   Set CrxReport = Nothing

   Set crxApplication = Nothing

   Saiencour0 = ""

End Sub

--------------------------------------------------------------------------------------------------------

Ne pas oublier de référencer le CRViewer

Ced code est utilisable quelleque soit le programme

JLTCODX
0
ecranbleu27 Messages postés 190 Date d'inscription vendredi 4 juin 2004 Statut Membre Dernière intervention 29 avril 2009 1
27 mai 2006 à 11:34
merci
je vais tester....
0
ecranbleu27 Messages postés 190 Date d'inscription vendredi 4 juin 2004 Statut Membre Dernière intervention 29 avril 2009 1
28 mai 2006 à 09:21
bon ca commence mal !
ds la partie :
Private Sub Form_Load()
On Error Resume Next
Set CrxReport = crxApplication.OpenReport(Rapport) ' Rapport= nom de l'édition CR9
Set ConnectionInfo = CrxReport.Database.Tables(1).ConnectionProperties
ConnectionInfo.Item("database Name") FicImpr 'FicImpr Base utilisée
CRViewer91.ReportSource = CrxReport 'Sets the Report source of the CrViewer to the Report object we created.
CRViewer91.Zoom 100
Screen.MousePointer = vbDefault
End Sub

pour "rapport" , heu je lui met quoi?
si je met le nom du rapport.rpt il me dit "un objet est requit" ?????
dois-je mettre l'adresse entiere c:\......
et tant qu'on y est pour database name , c'est pareil:
je remplace par le nom de ma base ?
merci
0
Rejoignez-nous