Results 1 to 6 of 6

Thread: HelP~~ Data Report got problem when read data from multiple database table...

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2007
    Posts
    445

    HelP~~ Data Report got problem when read data from multiple database table...

    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 ...??

    Code:
    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
    Last edited by wenight; Jul 23rd, 2007 at 07:15 AM.

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: HelP~~ Data Report got problem when read data from multiple database table...

    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"

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2007
    Posts
    445

    Re: HelP~~ Data Report got problem when read data from multiple database table...

    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???
    Code:
    rsPrint.Open sqlcom, Conn
    rsPrint.Open sqlyen, Conn
    rsPrint.Open sqlcn, Conn

  4. #4
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: HelP~~ Data Report got problem when read data from multiple database table...

    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

  5. #5
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: HelP~~ Data Report got problem when read data from multiple database table...

    School must be in session again. There are a lot of Data Environment questions about and regular programmers would never use such a thing...

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: HelP~~ Data Report got problem when read data from multiple database table...

    Moved to Reporting

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