Results 1 to 5 of 5

Thread: Data Reports- It's a big one

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    148
    Howdy!

    Is it possible to have 2 data sources on a Data Report?
    The reason I am asking is because I need to put 2 seperate tables in the same detail section.

    Example:

    Dim cn As New ADODB.Connection
    Dim rs,rs2 As New ADODB.Recordset
    Dim cmd,cmd2 As New ADODB.Command

    cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Test.mdb;"

    With cmd
    .ActiveConnection = cn
    .CommandType = adCmdText
    .CommandText = "Select * from tbl1 order by tbl1.Index"
    .Execute
    End With

    With cmd2
    .ActiveConnection = cn
    .CommandType = adCmdText
    .CommandText = "Select * from tbl2 order by Index"
    .Execute
    End With

    With rs
    .ActiveConnection = cn
    .CursorLocation = adUseClient
    .Open cmd
    End With

    With rs2
    .ActiveConnection = cn
    .CursorLocation = adUseClient
    .Open cmd2
    End With

    Dim q As Integer
    Dim intCtrl As Integer
    Dim X As Integer
    Dim z As Integer

    X = 0
    q = 1
    z = 1

    With DR
    Set .DataSource = rs
    .DataMember = ""

    With .Sections("Section1").Controls
    For intCtrl = 1 To .Count
    If TypeOf .Item(intCtrl) Is RptTextBox Then
    .Item(intCtrl).DataMember = ""
    .Item(intCtrl).DataField = rs(z).Name
    End If
    Next intCtrl
    End With
    End With

    With DR
    Set .DataSource = rs2
    .DataMember = ""
    With .Sections("Section1").Controls
    For intCtrl = 3 To .Count
    If TypeOf .Item(intCtrl) Is RptTextBox Then
    .Item(intCtrl).DataMember = ""
    .Item(intCtrl).DataField = rs2(q).Name
    q = q + 1
    End If
    Next intCtrl

    End With
    End With

    If I set the dr.Datasource to rs2, it loses connection with rs. If anyone has any suggestions, it would be great!

    Thanx

  2. #2
    Addicted Member
    Join Date
    May 2000
    Posts
    188
    can't you just create one recordset to return the information from both tables? if you need help post your sql for both recordsets and I'll see if I can help.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    148
    I need to select * from table1 and then select * from table2, but they have nothing in common.

  4. #4
    Addicted Member
    Join Date
    May 2000
    Posts
    188
    Then I don't know... as far as I know it isn't possible with the data reporter... maybe you could do it with crystal but I don't know as I haven't really used it much.

    Just out of curiosity what kind of information would you want to display in the details area that doesn't have anything at all in common with the rest of the information?

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    148
    Basically it is just Quantity and Length with a memo field.
    the memo field is the seperate recordset(table2)

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