By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,639 Members | 2,276 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,639 IT Pros & Developers. It's quick & easy.

Multiple Table in Crystal Report

P: 52

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.
Jul 7 '08 #1
Share this Question
Share on Google+
2 Replies

Expert 5K+
P: 8,127
you can create a view based on data of multiple tables.
Jul 7 '08 #2

P: 52
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.Connection
Dim crx As New CRAXDRT.Application
Dim rpt As CRAXDRT.Report
Dim db As CRAXDRT.Database
Dim rs As New ADODB.Recordset
Dim WithEvents sect As CRAXDRT.Section
Dim rptObject As CRAXDRT.ReportObjects
Dim i As Integer

Private Sub Form_Load()

Set cn = New ADODB.Connection
cn.Provider = "Microsoft.Jet.OLEDB.4.0"
cn.ConnectionString = "Data Source=" & App.Path & "\Everspark2.mdb"
cn.Properties("Jet OLEDB:Database Password") = "abc123"

Screen.MousePointer = vbHourglass
Set rpt = crx.OpenReport(App.Path & "\Report\Alternator5.rpt")
Set db = rpt.Database
Set sect = rpt.Sections("Section5")
'rs.Open "SELECT * FROM Alternator WHERE Alternator.EversparkNo = '" & frmProductCatalog.txtEversparkNo.Text & "'", cn, 1, 1

rpt.Database.SetDataSource rs, 3, 1
CRViewer1.ReportSource = rpt

Do While CRViewer1.IsBusy

CRViewer1.Zoom 1

Screen.MousePointer = vbDefault

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

Exit Sub

End Sub

Private Sub sect_Format(ByVal pFormattingInfo As Object)

Dim bmp As StdPicture

On Error Resume Next

With sect.ReportObjects

Set .Item("picImageFront").FormattedPicture = LoadPicture(App.Path & "\Alternator\101001A.jpg") 'default
Set .Item("picImageLeft").FormattedPicture = LoadPicture(App.Path & "\Alternator\101001B.jpg") 'default
Set .Item("picImageRight").FormattedPicture = LoadPicture(App.Path & "\Alternator\101001C.jpg") 'default
Set .Item("picPlugDetails").FormattedPicture = LoadPicture(App.Path & "\Alternator\Plugs\001P.jpg") 'default

If .Item("adoImgFront").Value <> "" Then
Set bmp = LoadPicture(App.Path & "\Images\Alternator\" & .Item("adoImgFront").Value)
Set .Item("picImageFront").FormattedPicture = bmp
End If

If .Item("adoImgLeft").Value <> "" Then
Set bmp = LoadPicture(App.Path & "\Images\Alternator\" & .Item("adoImgLeft").Value)
Set .Item("picImageLeft").FormattedPicture = bmp
End If

If .Item("adoImgRight").Value <> "" Then
Set bmp = LoadPicture(App.Path & "\Images\Alternator\" & .Item("adoImgRight").Value)
Set .Item("picImageRight").FormattedPicture = bmp
End If

If .Item("adoPlugDetails").Value <> "" Then
Set bmp = LoadPicture(App.Path & "\Images\Alternator\Plugs\" & .Item("adoPlugDetails").Value)
Set .Item("picPlugDetails").FormattedPicture = bmp
End If

End With

Set bmp = Nothing

End Sub

Private Sub Form_Resize()

CRViewer1.Top = 0
CRViewer1.Left = 0
CRViewer1.Height = ScaleHeight
CRViewer1.Width = ScaleWidth

End Sub

Private Sub Form_Unload(Cancel As Integer)


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
Jul 7 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.