Results 1 to 2 of 2

Thread: Crystal report problem

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Pilipinas
    Posts
    441

    ???????????????????

    (moved)
    Last edited by martialdc; Jun 3rd, 2007 at 09:34 PM.

  2. #2
    Member
    Join Date
    Nov 2002
    Location
    San Antonio, TX
    Posts
    35
    Change:

    rpt.DataDefinition.RecordSelectionFormula = "Select * employee where empposition='"& "Programmer" & "'"'

    to

    rpt.DataDefinition.RecordSelectionFormula = "{employee.empposition} = 'Programmer' "

    The selection formula is like the where clause.
    This is how I export report data setting the record selection formula at runtime:
    Code:
    Public Sub CreateImportFile
        Dim crxApp As New CRAXDRT.Application
        Dim crxRpt As CRAXDRT.Report
        
        'Open report
        Set crxRpt = crxApp.OpenReport(App.Path & "\report.rpt")
        
         crxRpt.RecordSelectionFormula = createSelectionFormula(parameterString)
        
        'Set export parameters
        With crxRpt
            .ExportOptions.DestinationType = crEDTDiskFile
            .ExportOptions.FormatType = crEFTCommaSeparatedValues
            .ExportOptions.DiskFileName = App.Path & "\rpt.txt"
        End With
        
        'Export report
        crxRpt.Export False
        
        'Destroy objects
        Set crxApp = Nothing
        Set crxRpt = Nothing
    
        Exit Sub
    End Sub
    
    Private Function createSelectionFormula(param As String) As String
    
        Dim sFormula As String
        
        sFormula = "{employee.empposition} = '" & param & "'"
        
        createSelectionFormula = sFormula
        
    End Function
    Last edited by munsworth; Sep 10th, 2003 at 03:26 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width