printing a register each time in the ttx 
Author Message
 printing a register each time in the ttx

Hi
  How can I print 1 register from recordset (onlly 1), after  read next
register from recordset and print it (only 1 again), using RDC with TTX ?
 Example Code below:

   Dim l_lng_EnvEmail As Long
   Dim l_lng_EnvCorreio As Long
   Dim l_lng_EnvErro As Long

   Dim l_ado_cmd As ADODB.Command

   Dim l_Str_pathTTX As String
   Dim l_Int_Campos  As Integer
   Dim l_Str_RegTTX  As String
   Dim l_Int_contY As Integer
   Dim l_int_contX As Integer
   Dim l_int_pagnum As Integer

   Dim l_crp_dataObject As CrystalDataObject.CrystalComObject

   l_lng_EnvCorreio = 0
   l_lng_EnvCorreio = 0
   l_lng_EnvErro = 0

   f_ADO_rs.MoveFirst

   'path  TTx
   l_Str_pathTTX = App.Path & "\02 - Relatrios\informeIR.ttx"
   Set f_Crp_Application = Nothing
   Set f_Crp_Application = New CRPEAuto.Application
   'open report
   Set objReport = f_Crp_Application.OpenReport(App.Path & "\02 -
Relatrios\informeIR.rpt")

   Set f_crp_colecao_formulas = objReport.FormulaFields
    Set f_crp_objeto_formula_2 = f_crp_colecao_formulas.Item("ANO")
f_crp_objeto_formula_2.Text = "'" & IIf(Len(Trim(txtAno)) = 0,
Format(Now, "YYYY"), txtAno.Text) & "'"

   Set f_Crp_DataObject = New CrystalDataObject.CrystalComObject
   Set l_crp_dataObject = New CrystalDataObject.CrystalComObject

   Open l_Str_pathTTX For Input As #1
   l_Int_Campos = 0
   '*---------------------------------*
   '* read each row from  file TTX and building layout
   '*---------------------------------*
   Do While Not EOF(1)
      Line Input #1, l_Str_RegTTX
      If Len(l_Str_RegTTX) <> 0 And Right(l_Str_RegTTX, 2) <> "%%" And
Left(l_Str_RegTTX, 1) <> ";" Then

         f_Crp_DataObject.AddField Split(l_Str_RegTTX, vbTab)(0), vbString
         l_crp_dataObject.AddField Split(l_Str_RegTTX, vbTab)(0), vbString
         l_Int_Campos = l_Int_Campos + 1
      End If
   Loop
   Close #1
   f_ADO_rs.MoveFirst
   l_int_pagnum = 0
   With f_ADO_rs
      Do While Not .EOF()

         ReDim f_Arr_Labels(0, l_Int_Campos - 1)

         Set objDB = Nothing
         Set objTables = Nothing
         Set objTable = Nothing

         l_Int_contY = 0
         For l_int_contX = 0 To .Fields.Count - 1
            f_Arr_Labels(l_Int_contY, l_int_contX) = CStr("" &
PreencheCamposNull(.Fields(l_int_contX).Value, vbString))
         Next l_int_contX
       '********************************************
       ' * HERE It forever add rows, I tried to do  set  f_Crp_DataObject =
nothing ,          but  do not work

'*********************************************************************

         f_Crp_DataObject.AddRows f_Arr_Labels

         Set objDB = objReport.Database
         Set objTables = objDB.Tables
         Set objTable = objTables.Item(1)

         objTable.SetPrivateData 3, f_Crp_DataObject
         objReport.DiscardSavedData
         If optemail.Value And Len(Trim(f_ADO_rs("e_mail"))) > 0 Then
            l_lng_EnvEmail = l_lng_EnvEmail + 1
            With objReport.ExportOptions

               .DestinationType = 2
               .FormatType = 14

               .MailToList = Trim(f_ADO_rs("e_mail"))
               .MailSubject = "my subject"
            End With
            objReport.Export (False)
            f_int_TipoEnvio = TpEmail
         Else
            l_lng_EnvCorreio = l_lng_EnvCorreio + 1
            f_int_TipoEnvio = TpCorreio
            'objReport.PrintOut False, 1, , l_int_pagnum + 1, 999
            objReport.Preview
         End If
        Set f_Crp_DataObject = Nothing
         l_int_pagnum = l_int_pagnum + 1
        'read next record
         .MoveNext
      Loop
   End With



Mon, 14 Feb 2005 16:51:42 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Change TTX location at Run-Time - Please Help....

2. print a row in the TTX

3. Subreport(based on ttx) causes Gpf when printing

4. Printing total time, not time of day

5. Register problems, VB Setup dont register HTML.OCX, cant load or register

6. Printing problem : several prints at same time

7. Printing problem : several prints at same time

8. Printing problem several prints at same time

9. Printing the Print Time Using Crystal Reports 4.5

10. How to register an OCX at run-time in VB

11. Still time to register -- Testing Computer Software (TCS2001) Conference

12. Run-Time Error 713 - Class not registered (DAO?)

 

 
Powered by phpBB® Forum Software