Private Sub CmdOk_Click() Dim RsRojmelIncome As New ADODB.Recordset Dim RsRojmelExp As New ADODB.Recordset Dim RsTempRojmel As New ADODB.Recordset cn.Execute "delete from TempRojmel" RsRojmelIncome.Open " select * from Rojmel where Date1 BETWEEN #" & Format(DTPicker1.Value, "MM/DD/yyyy") & "# AND #" & Format(DTPicker2.Value, "MM/DD/YYYY") & "# And IncExp = 'ytJtf'", cn, adOpenKeyset, adLockOptimistic RsRojmelExp.Open " select * from Rojmel where Date1 BETWEEN #" & Format(DTPicker1.Value, "MM/DD/yyyy") & "# AND #" & Format(DTPicker2.Value, "MM/DD/YYYY") & "# And IncExp = 'SJtf'", cn, adOpenKeyset, adLockOptimistic Set RsTempRojmel = New ADODB.Recordset RsTempRojmel.Open "Select * from TempRojmel", cn, adOpenKeyset, adLockOptimistic If RsRojmelIncome.RecordCount >= 1 Then For i = 1 To RsRojmelIncome.RecordCount RsTempRojmel.AddNew RsTempRojmel.Fields("Id") = i RsTempRojmel.Fields("IncVigat") = RsRojmelIncome.Fields("Vigat") RsTempRojmel.Fields("Date1") = RsRojmelIncome.Fields("Date1") RsTempRojmel.Fields("IncAmount") = RsRojmelIncome.Fields("Amount") RsTempRojmel.Update RsRojmelIncome.MoveNext Next i End If If RsRojmelExp.RecordCount >= 1 Then For j = 1 To RsRojmelExp.RecordCount RsTempRojmel.AddNew RsTempRojmel.Fields("Id") = j RsTempRojmel.Fields("ExpVigat") = RsRojmelExp.Fields("Vigat") RsTempRojmel.Fields("Date1") = RsRojmelExp.Fields("Date1") RsTempRojmel.Fields("ExpAmount") = RsRojmelExp.Fields("Amount") RsTempRojmel.Update RsRojmelExp.MoveNext Next j End If If DataEnvironment1.rsCommand1_Grouping.State = 0 Then DataEnvironment1.rsCommand1_Grouping.Open " SHAPE {SELECT * FROM `TempRojmel`} AS Command1 COMPUTE Command1, SUM(Command1.'IncAmount') AS Aggregate1, SUM(Command1.'ExpAmount') AS Aggregate2,CALC (Aggregate1-Aggregate2) as NetProf1 BY 'Date1' ", DataEnvironment1.Connection1, adOpenKeyset, adLockOptimistic End If RptRojmel.Sections("Section7").Controls.Item("Text1").DataField = DataEnvironment1.rsCommand1_Grouping.Fields("NetProf1").Name RptRojmel.Sections("Section7").Controls.Item("Text2").DataField = DataEnvironment1.rsCommand1_Grouping.Fields("Aggregate1").Name RptRojmel.Sections("Section4").Controls.Item("LblDate1").Caption = DTPicker1.Value RptRojmel.Sections("Section4").Controls.Item("LblDate2").Caption = DTPicker2.Value RptRojmel.Refresh DataEnvironment1.rsCommand1_Grouping.Requery RptRojmel.Show RptRojmel.Refresh End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)