Results 1 to 2 of 2

Thread: passing arrays in crystal reports

  1. #1
    Guest

    Unhappy

    i have an array of say customer codes.
    i want to pass it to crystal report , so that it shows records of only those customers.

    pls hep me as to how to go abt it and what i've to set in crsytal repots ie selection formula etc

    thanks


  2. #2
    Lively Member
    Join Date
    Apr 2000
    Location
    Rafaela (Argentine)
    Posts
    107
    You can't pass an array to Crystal Reports. But you can set the selection formula of the Crystal Report control, so the report selects only those records that matches the elements in the array. You can use this:

    Code:
    Dim strSelection As String, k As Integer
        
    strSelection = ""
    For k = 0 To UBound(varArray) - 1
        strSelection = strSelection & " OR {table.field} = " & varArray(k)
    Next k
    ' Cut first ' OR '
    strSelection = Right(strSelection, Len(strSelection) - 4)
    CrystalReport1.SelectionFormula = strSelection
    where {table.field} is the field that contains customer code.

    Hope it works!

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