Results 1 to 5 of 5

Thread: Passing Parameters from vb to crystal report

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    Brunei
    Posts
    100
    Hi,

    Can any one help with passing parameters from vb program to crystal reports.

    Example:

    Crystal report displays the Customer details from NWind.mdb.
    I want to pass the parameter, CustomerID = XYZ.


    Any help would be greatly appreciated.

    Thank you.

    Rathi


  2. #2
    New Member
    Join Date
    Sep 2000
    Posts
    5
    The following should work
    CrystalReport1.SelectionFormula = "{CustomerID} = 'xyz'"

    Set CrystalReport1.SelectionFormula = "" at end of program or else the report will hold the last Selection Formula

    Hope this helps
    Mick

    [Edited by cautious on 09-27-2000 at 05:05 AM]

  3. #3
    Lively Member
    Join Date
    Jun 2000
    Location
    Belgium
    Posts
    77
    Sorry Cautious, but SelectionFormula is the where clause of the SQL and Rahi ask for parameters (for changing this you must use CrystalReport1.ReplaceSelectionFormula = "{CustomerID} = 'xyz'")

    For passing parameters, you must use this code
    Code:
     ' Syntax : CrystalReport1.ParameterFields(ArrayIndex)="ParameterName;
    NewValue;SetCurrentValue"
     ' Where :
     '  ArrayIndex is an index from 0 to the number of parameters to pass (there is no link between parametername and the index number)
     '  ParameterName is the name of the parameter in the crystal report (case sensitive)
     ' NewValue is the new value to put to the parameter
     ' SetCurrentValue is equal to "TRUE" or "FALSE"
     '   TRUE : the parameter value is passed to the current value in the report; the user is not prompted to enter the parameter value.
     '   FALSE: the parameter value is passed to the default value for the parameter; the user is prompted to enter the parameter value, with the value you set showing as the default value.
     CrystalReport1.ParameterFields(0)="CustomerID;xyz;TRUE"
    [Edited by kwell on 09-27-2000 at 05:27 AM]
    KWell

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    Brunei
    Posts
    100
    Originally posted by KWell
    Sorry Cautious, but SelectionFormula is the where clause of the SQL and Rahi ask for parameters (for changing this you must use CrystalReport1.ReplaceSelectionFormula = "{CustomerID} = 'xyz'")

    For passing parameters, you must use this code
    Code:
     ' Syntax : CrystalReport1.ParameterFields(ArrayIndex)="ParameterName;
    NewValue;SetCurrentValue"
     ' Where :
     '  ArrayIndex is an index from 0 to the number of parameters to pass (there is no link between parametername and the index number)
     '  ParameterName is the name of the parameter in the crystal report (case sensitive)
     ' NewValue is the new value to put to the parameter
     ' SetCurrentValue is equal to "TRUE" or "FALSE"
     '   TRUE : the parameter value is passed to the current value in the report; the user is not prompted to enter the parameter value.
     '   FALSE: the parameter value is passed to the default value for the parameter; the user is prompted to enter the parameter value, with the value you set showing as the default value.
     CrystalReport1.ParameterFields(0)="CustomerID;xyz;TRUE"
    [Edited by kwell on 09-27-2000 at 05:27 AM]

    Hi Friends,

    Thanks for your support.

    I'm going to use your suggestions, hope I can come back if I have any difficulties.

    Thanks again.

    Rathi

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Location
    Brunei
    Posts
    100
    [QUOTE]Originally posted by rathi
    [B][QUOTE]Originally posted by KWell
    [B]Sorry Cautious, but SelectionFormula is the where clause of the SQL and Rahi ask for parameters (for changing this you must use CrystalReport1.ReplaceSelectionFormula = "{CustomerID} = 'xyz'")

    For passing parameters, you must use this code
    Code:
     ' Syntax : CrystalReport1.ParameterFields(ArrayIndex)="ParameterName;
    NewValue;SetCurrentValue"
     ' Where :
     '  ArrayIndex is an index from 0 to the number of parameters to pass (there is no link between parametername and the index number)
     '  ParameterName is the name of the parameter in the crystal report (case sensitive)
     ' NewValue is the new value to put to the parameter
     ' SetCurrentValue is equal to "TRUE" or "FALSE"
     '   TRUE : the parameter value is passed to the current value in the report; the user is not prompted to enter the parameter value.
     '   FALSE: the parameter value is passed to the default value for the parameter; the user is prompted to enter the parameter value, with the value you set showing as the default value.
     CrystalReport1.ParameterFields(0)="CustomerID;xyz;TRUE"
    [Edited by rathi on 09-28-2000 at 05:35 AM]

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