Results 1 to 3 of 3

Thread: crystal report and vb 6.0?

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2008
    Posts
    5

    crystal report and vb 6.0?

    I have problem with dynamic generation with crystal report.My code is like

    Dim CN As New ADODB.Connection
    Dim rss As New Recordset
    Dim vcryapp New CRAXDDRT.Application
    Dim vrpt As New CRAXDDRT.Report

    cn = "ADO connection string with oledb provider for oracle,username,password etc"
    rss="select course_name,course_fees from course",cn

    set vrpt= vcryapp.OpenReport("E:\test\report2.rpt")

    vrpt.Database.SetDataSource rss
    [ it will give error like subscript out of range ]

    actully what will be the content of report2.rpt file. i want to select field dynamically not static. when i create a report with all fields of all then it will dispay total field i want to select any of them at per require.

    another problem i will add all field in report file but each and every time i run it from vb with placing CRViewer it will ask for connection i.e. connection dialog as we use for ado connection.

    when we are selecting field dynamically then what will be the content of report file.
    i m using crystal report 8.5

    thanx in advance.

  2. #2
    Frenzied Member
    Join Date
    Aug 2006
    Location
    India, Punjab, Bhatinda
    Posts
    1,689

    Re: crystal report and vb 6.0?

    Please use code or VBCode Tags while posting.

    There more than one way of doing it
    1.
    Code:
    vrpt.SQLQueryString = <your SQL query>
    2.having parameters which you should find in the Field Explorer
    3. Using Select Expert Report->Select Expert..

  3. #3
    Member
    Join Date
    May 2009
    Posts
    55

    Re: crystal report and vb 6.0?

    VB Code:
    1. Dim CN As New ADODB.Connection
    2. Dim rss As New Recordset
    3. Dim vcryapp New CRAXDDRT.Application
    4. Dim vrpt As New CRAXDDRT.Report
    5.  
    6. cn = "ADO connection string with oledb provider for oracle,username,password etc"
    7. rss="select course_name,course_fees from course",cn
    8.  
    9. set vrpt= vcryapp.OpenReport("MyProjects\Reports\Report2.rpt")
    10.  
    11. vrpt.Database.SetDataSource rss

    The better you use a relative path for report file.

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