Results 1 to 4 of 4

Thread: Pass a Public Variable to Crystal Report

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2002
    Location
    midewest u.s.
    Posts
    275

    Pass a Public Variable to Crystal Report

    Hello,

    Is there any way to pass a Public VB Variable to a Crystal Report to use in its forumla? I need to select a name out of a combobox and then use that text to pull information from the orcale database and show it in the crystal report? If thats possible any help or links related to it you could give me would be great. Thanks in advance

  2. #2
    Member EagleEye's Avatar
    Join Date
    May 2002
    Location
    South Carolina, USA
    Posts
    43
    Let me preface this with "I use MS SQL not Oracle" so if there are differences I apologize.

    Why not pass the name from the combobox to your SELECT statement that you use to fill the dataset.

    This Will require that you use a "Typed Report".

    <perform on generate report button click>
    sqlSelectCommand.Parameters("@name").value = cboName.text

    sqlSelectCommand.CommandText = "SELECT * from Table where name like @name"

    DataAdapter.fill(dsYourDataset.Table)

    crReportName1.SetDataSource(dsYourDataset.Table)

    crvReportViewer.ReportSource(crReprtName1)


    Hope this helps.
    Last edited by EagleEye; Nov 20th, 2002 at 03:11 PM.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2002
    Location
    midewest u.s.
    Posts
    275
    Dim DA As New OleDb.OleDbDataAdapter("SELECT dic01_last_name ||', '|| dic01_first_name as Name, from dic01_student where dic01_student_id = 108 order by dic01_first_name", CN)

    Dim DS As New DataSet()

    DA.Fill(DS)

    act.SetDataSource(DS.Tables)

    crView.ReportSource = act

    I tried that, and the dataset filled fine, but the crystal report wont show anything, this is my first time messing with crystal reports, so i might be a little slow. thanks for the help though. I will work with it a little more and see if i can figure out another way. Any ideas and i would be grateful.
    Last edited by Tool; Nov 20th, 2002 at 03:40 PM.

  4. #4
    Member EagleEye's Avatar
    Join Date
    May 2002
    Location
    South Carolina, USA
    Posts
    43
    You have to use both a typed dataset and a typed report based off that typed data set. Otherwise the report won't know what data goes where.

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