Multiple Table in Crystal Report

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vaniKanabathy
    New Member
    • Mar 2008
    • 52

    Multiple Table in Crystal Report

    hi,

    I need a help regarding crystal report in vb6. I need to retrieve data from 3 tables in 1 report.I have do data and image retrieving from single table but now i need to display data from 3 table.How can i do so?Please help me...urgent to finish up my project.

    Thanks in advance.
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    you can create a view based on data of multiple tables.

    Comment

    • vaniKanabathy
      New Member
      • Mar 2008
      • 52

      #3
      View based report ? Im doing a view based report also. Im confused here. I give my code for single table report .

      Option Explicit
      Dim cn As ADODB.Connectio n
      Dim crx As New CRAXDRT.Applica tion
      Dim rpt As CRAXDRT.Report
      Dim db As CRAXDRT.Databas e
      Dim rs As New ADODB.Recordset
      Dim WithEvents sect As CRAXDRT.Section
      Dim rptObject As CRAXDRT.ReportO bjects
      Dim i As Integer

      Private Sub Form_Load()

      Set cn = New ADODB.Connectio n
      cn.Provider = "Microsoft.Jet. OLEDB.4.0"
      cn.ConnectionSt ring = "Data Source=" & App.Path & "\Everspark2.md b"
      cn.Properties(" Jet OLEDB:Database Password") = "abc123"
      cn.Open

      Screen.MousePoi nter = vbHourglass
      Set rpt = crx.OpenReport( App.Path & "\Report\Altern ator5.rpt")
      Set db = rpt.Database
      Set sect = rpt.Sections("S ection5")
      'rs.Open "SELECT * FROM Alternator WHERE Alternator.Ever sparkNo = '" & frmProductCatal og.txtEverspark No.Text & "'", cn, 1, 1

      rpt.DiscardSave dData
      rpt.Database.Se tDataSource rs, 3, 1
      Me.Refresh
      CRViewer1.Repor tSource = rpt
      CRViewer1.ViewR eport

      Do While CRViewer1.IsBus y
      DoEvents
      Loop

      CRViewer1.Zoom 1

      Screen.MousePoi nter = vbDefault

      Set crx = Nothing
      Set rpt = Nothing
      Set rs = Nothing
      Set sect = Nothing
      Set rptObject = Nothing

      Exit Sub

      End Sub


      Private Sub sect_Format(ByV al pFormattingInfo As Object)

      Dim bmp As StdPicture

      On Error Resume Next

      With sect.ReportObje cts

      Set .Item("picImage Front").Formatt edPicture = LoadPicture(App .Path & "\Alternator\10 1001A.jpg") 'default
      Set .Item("picImage Left").Formatte dPicture = LoadPicture(App .Path & "\Alternator\10 1001B.jpg") 'default
      Set .Item("picImage Right").Formatt edPicture = LoadPicture(App .Path & "\Alternator\10 1001C.jpg") 'default
      Set .Item("picPlugD etails").Format tedPicture = LoadPicture(App .Path & "\Alternator\Pl ugs\001P.jpg") 'default

      If .Item("adoImgFr ont").Value <> "" Then
      Set bmp = LoadPicture(App .Path & "\Images\Altern ator\" & .Item("adoImgFr ont").Value)
      Set .Item("picImage Front").Formatt edPicture = bmp
      End If

      If .Item("adoImgLe ft").Value <> "" Then
      Set bmp = LoadPicture(App .Path & "\Images\Altern ator\" & .Item("adoImgLe ft").Value)
      Set .Item("picImage Left").Formatte dPicture = bmp
      End If

      If .Item("adoImgRi ght").Value <> "" Then
      Set bmp = LoadPicture(App .Path & "\Images\Altern ator\" & .Item("adoImgRi ght").Value)
      Set .Item("picImage Right").Formatt edPicture = bmp
      End If

      If .Item("adoPlugD etails").Value <> "" Then
      Set bmp = LoadPicture(App .Path & "\Images\Altern ator\Plugs\" & .Item("adoPlugD etails").Value)
      Set .Item("picPlugD etails").Format tedPicture = bmp
      End If

      End With

      Set bmp = Nothing

      End Sub

      Private Sub Form_Resize()

      CRViewer1.Top = 0
      CRViewer1.Left = 0
      CRViewer1.Heigh t = ScaleHeight
      CRViewer1.Width = ScaleWidth

      End Sub

      Private Sub Form_Unload(Can cel As Integer)

      cn.Close
      frmProductCatal og.Show

      End Sub


      i used this code 2 retrieve data and image from 1 table. But now i want to retrieve more information from another different table within the same report ....i cant get the solution..yet.. Please help me...Thanks

      Comment

      Working...