estimados tengo esta MSHFlexGrid y neesito sumar el valor que esntrega el campo (prima_us_acu) pero el total de todos los reguistros
y enviar el total a un Label es pocible hacer esto
gracias por la ayuda
Código PHP:
'Llama a la base de cador y muestra en la Grilla
Sub mLlenarGrilla(mfgRet As MSHFlexGrid)
Dim strSql As String
Dim adoRs As New ADODB.Recordset
Dim strAux As String
Dim lngFila As Long
Abre_Base
strSql = vbNullString
strAux = vbNullString
strSql = "Select * from produ_comercial where "
strSql = "Select sum(prima_us_acu) as prima_us_acu,mes, year from produ_comercial where "
'strAux = " Where RE_Id <> -1 "
If cmblinea.ListIndex <> -1 Then
strAux = strAux & "linea = '" & cmblinea.Text & "' "
End If
If cmbperiodo.ListIndex <> -1 Then
If cmbperiodo.ListIndex = 0 Then
strAux = strAux & " and mes in ('1','2','3')"
End If
If cmbperiodo.ListIndex = 1 Then
strAux = strAux & " and mes in ('4','5','6')"
End If
If cmbperiodo.ListIndex = 2 Then
strAux = strAux & " and mes in ('7','8','9')"
End If
If cmbperiodo.ListIndex = 3 Then
strAux = strAux & " and mes in ('10','11','12')"
End If
End If
If cmbfecha1.ListIndex <> -1 Then
strAux = strAux & " and year between " & cmbfecha1.Text & ""
End If
If cmbfecha2.ListIndex <> -1 Then
strAux = strAux & " and " & cmbfecha2.Text & ""
End If
strSql = strSql & strAux
strSql = strSql & " group by mes,year order by mes asc"
lngFila = 0
Call FormatoGrilla
If dbCreaConsultaRapida(strSql, adoRs) Then
Do While Not adoRs.EOF
mfgRet.Col = 1
mfgRet.Row = mfgRet.Rows - 1
If mfgRet.Text <> "" Then
mfgRet.Rows = mfgRet.Rows + 1
End If
mfgRet.Row = mfgRet.Rows - 1
lngFila = lngFila + 1
If Not IsNull(adoRs![mes]) Then
If (adoRs!mes) = 1 Or (adoRs!mes) = 2 Or (adoRs!mes) = 3 Then
mfgRet.TextMatrix(lngFila, mcintColperiodo) = "1st Quarter"
End If
If (adoRs!mes) = 4 Or (adoRs!mes) = 5 Or (adoRs!mes) = 6 Then
mfgRet.TextMatrix(lngFila, mcintColperiodo) = "2nd Quarter"
End If
If (adoRs!mes) = 7 Or (adoRs!mes) = 8 Or (adoRs!mes) = 9 Then
mfgRet.TextMatrix(lngFila, mcintColperiodo) = "3rd Quarter"
End If
If (adoRs!mes) = 10 Or (adoRs!mes) = 11 Or (adoRs!mes) = 12 Then
mfgRet.TextMatrix(lngFila, mcintColperiodo) = "4th Quarter"
End If
End If
If Not IsNull(adoRs![Year]) Then
mfgRet.TextMatrix(lngFila, mcintColfecha) = adoRs!Year
End If
If Not IsNull(adoRs![prima_us_acu]) Then
mfgRet.TextMatrix(lngFila, mcintprima) = adoRs!prima_us_acu
End If
adoRs.MoveNext
Loop
End If
Set adoRs = Nothing
End Sub