Private Sub ReceiveCompute()
Dim Str, sY, sM, Tm As String
Dim sqlrec As String
Dim sqlCust, mon As String
Dim i, k, M As Integer
Dim sumprice1 As Currency
i = 1
sqlrec = "select substring(BILL_DATE,'7') As bill_date,SUM(BILL_TOTALNET) As bill_sum"
sqlrec = sqlrec & " From bill"
sqlrec = sqlrec & " WHERE substring(BILL_DATE,'yyyy') = '" & CmbYear.text & "'"
sqlrec = sqlrec & " GROUP BY substring(BILL_DATE,'7') "
sqlrec = sqlrec & " ORDER BY 1"
With rsrec
If .State = adStateOpen Then .close
.ActiveConnection = SetDSNConnection
.CursorLocation = adUseClient
.CursorType = adOpenForwardOnly
.LockType = adLockOptimistic
.Open sqlrec
If rsrec.BOF = False Then
rsrec.MoveFirst
Do
Str = DateAdd("yyyy", 0, rsrec!bill_date)
With MSF_IN
.TextMatrix(i, 0) = i & "."
.TextMatrix(i, 1) = Format(Str, "mmmm/yyyy")
.TextMatrix(i, 2) = Format(rsrec!bill_sum, "#,##0.00")
.Rows = .Rows + 1
End With
i = i + 1
rsrec.MoveNext
Loop Until rsrec.EOF = True
End If
End With
With MSF_IN
For k = 1 To MSF_IN.Rows - 2
sumprice1 = sumprice1 + Format(.TextMatrix(k, 2), "#,##0.00")
Next
End With
Label7.Caption = Format(sumprice1, "#,##0.00")
End Sub