PDA

Click to See Complete Forum and Search --> : HelP~~ Data Report got problem when read data from multiple database table...


wenight
Jul 23rd, 2007, 06:52 AM
Can Data Report read data from diffrent table...???
because when at final set the Report.DataSource can only set to one record set... if I wan read from two table I ahve two record set......

Data Report can read data into label?? like Report.Label1.Caption= xxx ...??

Dim sqlcom As String
Dim rscom As New ADODB.Recordset

sqlcom = "SELECT * FROM Company"
rscom.Open sqlcom, Conn

With Report.Sections("Section1").Controls
.Item("Text7").DataField = rscom("CompanyName").Name
.Item("Text8").DataField = rscom("Address").Name
End With


Dim rsPrint As New ADODB.Recordset
Dim strPrint As String

strPrint = "SELECT * FROM QuoDetail"
rsPrint.Open strPrint, Conn

With Report.Sections("Section1").Controls
.Item("Text1").DataField = rsPrint("ItemNo").Name
.Item("Text2").DataField = rsPrint("ItemDescription").Name
.Item("Text3").DataField = rsPrint("Quantity").Name
End With

Set Report.DataSource = rsPrint
Load Report

brucevde
Jul 23rd, 2007, 12:04 PM
The DataReport can only be bound to one Recordset but the recordset itself can of course contain data from multiple tables.

Data Report can read data into label?? like Report.Label1.Caption= xxx ...?? You can set the Caption of a Label using

DataReport1.Sections(Section Name).Controls(Control Name).Caption
for example
DataReport1.Sections("Section1").Controls("Label1").Caption = "Hello"

wenight
Jul 24th, 2007, 06:35 AM
The DataReport can only be bound to one Recordset but the recordset itself can of course contain data from multiple tables.


You mean can use can apply as like that???

rsPrint.Open sqlcom, Conn
rsPrint.Open sqlyen, Conn
rsPrint.Open sqlcn, Conn

brucevde
Jul 24th, 2007, 09:58 AM
You mean can use can apply as like that??? ??? I have no idea what you mean.

You would use SQL to create a single recordset from multiple tables. Something like

Select Customers.CompanyName, Orders.OrderId, Orders.OrderDate
From Customers Inner Join Orders On Orders.CustomerId = Customers.CustomerId

randem
Jul 24th, 2007, 02:35 PM
School must be in session again. There are a lot of Data Environment questions about and regular programmers would never use such a thing...

Hack
Jul 25th, 2007, 06:12 AM
Moved to Reporting