Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Crystal Report

Crystal Report

Scheduled Pinned Locked Moved Visual Basic
databasesysadmin
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    magedhv
    wrote on last edited by
    #1

    Hi I need to know the Crystal report4.6 and 9 and 10 code to display the report from VB6 actually i have wrote the below code and it displays the report but not results is not right however it was right when i was designing the report the code is

    Dim cn1 As New ADODB.Connection

    cn1.Open ("provider=SQLOLEDB;server=CAI-MAGEDH-DT;database=Att;user id=-;pwd=-")

    cn1.Execute "drop view CAR"

    cn1.Execute "Create View CAR as SELECT Badgeholder ,Count(DISTINCT bdate) as Days ,9 as rate, Count(DISTINCT bdate) * 9 as Total from Newatt n inner join Bnames b on n.badgeholder = b.Snames group by badgeholder"

    Dim reportfile As New CRAXDRT.Application

    If cn.State = 1 Then cn.Close

    If rs.State = 1 Then rs.Close

    cn.Open ("provider=SQLOLEDB;server=CAI-MAGEDH-DT;database=Att;user id=-;pwd=-")

    rs.ActiveConnection = cn

    rs.CursorType = adOpenKeyset

    rs.LockType = adLockOptimistic

    rs.Source = "SELECT * FROM NewAtt"

    rs.Open

    Dim reports As report

    Set report = reportfile.OpenReport(App.Path & "/car1.rpt")

    report.Database.SetDataSource rs

    Form2.CRViewer91.ReportSource = report

    Form2.CRViewer91.EnableExportButton = True

    Form2.CRViewer91.DisplayGroupTree = False

    Form2.CRViewer91.EnableProgressControl = True

    Form2.CRViewer91.EnableProgressControl = True

    Form2.CRViewer91.ViewReport

    Form2.CRViewer91.Zoom 1

    Form2.Show

    L 1 Reply Last reply
    0
    • M magedhv

      Hi I need to know the Crystal report4.6 and 9 and 10 code to display the report from VB6 actually i have wrote the below code and it displays the report but not results is not right however it was right when i was designing the report the code is

      Dim cn1 As New ADODB.Connection

      cn1.Open ("provider=SQLOLEDB;server=CAI-MAGEDH-DT;database=Att;user id=-;pwd=-")

      cn1.Execute "drop view CAR"

      cn1.Execute "Create View CAR as SELECT Badgeholder ,Count(DISTINCT bdate) as Days ,9 as rate, Count(DISTINCT bdate) * 9 as Total from Newatt n inner join Bnames b on n.badgeholder = b.Snames group by badgeholder"

      Dim reportfile As New CRAXDRT.Application

      If cn.State = 1 Then cn.Close

      If rs.State = 1 Then rs.Close

      cn.Open ("provider=SQLOLEDB;server=CAI-MAGEDH-DT;database=Att;user id=-;pwd=-")

      rs.ActiveConnection = cn

      rs.CursorType = adOpenKeyset

      rs.LockType = adLockOptimistic

      rs.Source = "SELECT * FROM NewAtt"

      rs.Open

      Dim reports As report

      Set report = reportfile.OpenReport(App.Path & "/car1.rpt")

      report.Database.SetDataSource rs

      Form2.CRViewer91.ReportSource = report

      Form2.CRViewer91.EnableExportButton = True

      Form2.CRViewer91.DisplayGroupTree = False

      Form2.CRViewer91.EnableProgressControl = True

      Form2.CRViewer91.EnableProgressControl = True

      Form2.CRViewer91.ViewReport

      Form2.CRViewer91.Zoom 1

      Form2.Show

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Open the .rpt file, open report properties and uncheck 'Save data with report' option.

      M 1 Reply Last reply
      0
      • L Lost User

        Open the .rpt file, open report properties and uncheck 'Save data with report' option.

        M Offline
        M Offline
        magedhv
        wrote on last edited by
        #3

        First i'd like to thank you for you reply but i kow this option and i have already unchecked it with no avail the problem that when i run the RPT file it works good but when it run under VB through code it displays the report in wrong way is it because i did inner join in my SQL Statement?

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups