Results 1 to 5 of 5

Thread: Getting data from two recordsets problem

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2010
    Location
    Pakistan
    Posts
    289

    Getting data from two recordsets problem

    Plz help me:
    I displayed data on datareport from two recordsets. Report is also attached. The problem is:
    Date is display twice, i want to display date in once and data should display against the date from both recordset. I used the code
    Code:
         rsFee.Open "SELECT CurrentDate, SUM(DepositedFee) AS `DepositedFee` FROM Fee WHERE month(CurrentDate)= " & cmbMonth.Text & " and year (CurrentDate)= " & txtYear.Text & " GROUP BY CurrentDate order by currentdate", myConn, adOpenKeyset, adLockOptimistic
         rsIncome.Open "SELECT CurrentDate, Sum(Amount) as `Income` FROM tbTransaction WHERE HEAD='INCOME' AND month(CurrentDate)= " & cmbMonth.Text & " and year (CurrentDate)= " & txtYear.Text & " group by currentDate order by currentdate", myConn, adOpenKeyset, adLockOptimistic
    
    '**********************************************************************************
        theRs.Fields.Append "Currentdate", adDate
        theRs.Fields.Append "DepositedFee", adDouble
        theRs.Fields.Append "Concession", adDouble
        theRs.Fields.Append "Total", adDouble
        theRs.Fields.Append "Income", adDouble
        
        
        theRs.Open
        While Not rsFee.EOF
        theRs.AddNew
        theRs.Fields!CurrentDate = rsFee.Fields!CurrentDate
        theRs.Fields!DepositedFee = rsFee.Fields!DepositedFee
        theRs.Update
        rsFee.MoveNext
        Wend
        
        While Not rsIncome.EOF
        theRs.AddNew
        theRs.Fields!CurrentDate = rsIncome.Fields!CurrentDate
        theRs.Fields!Income = rsIncome.Fields!Income
        theRs.Update
        rsIncome.MoveNext
        Wend
        theRs.Sort = "currentdate"
        theRs.MoveFirst
        Set rptMonIncome.DataSource = theRs
        rptMonIncome.DataMember = theRs.DataMember
    
         rptMonIncome.Show
            Unload Me
    Attached Images Attached Images  

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