Select
tema enviado por gavafra en Visual Basic 6.0
tema iniciado el 15/07/2010
Hola, tengo esta instruccion para elaborar un reporte con Data Report, todo lo hace bien excepto el total con letra , esta funcion lo tengo en un modulo BAS y solo me toma el primer SUB TOTAL del reporte pero si hay dos o tres o mas articulos la suma la hace bien, pero el total de la suma de los SUB TOTALES no.
este es el codigo que tengo
Dim cEnLetras As String
With TuRecordset
If .State Then
.Close
.Open "SELECT CONCEPTO, IDENT, NUME, PACIENTE, RECETA, CANTIDAD, SUSTANCIA_ACTIVA, PRESENTACION, PRECIO_VENTA, CANTIDAD, (PRECIO_VENTA * CANTIDAD) AS SUB_TOTAL, SUM(SUB_TOTAL) AS GTOT FROM PEDIDOS GROUP BY NUME,CONCEPTO,IDENT,PACIENTE,RECETA,CANTIDAD,SUSTANCIA_ACTIVA,PRESENTACION,PRECIO_VENTA,SUB_TOTAL HAVING SUM(SUB_TOTAL) AND CONCEPTO LIKE '%" & Label2.Caption & "%' And IDENT LIKE '%" & Text1.Text & "%' AND NUME LIKE '" & Text2.Text & "'", Conex, adOpenStatic, adLockOptimistic
Set DataReport1.DataSource = TuRecordset
DataReport1.Sections("Section2").Controls("label19").Caption = TuRecordset!NUME
DataReport1.Sections("Section2").Controls("label20").Caption = TuRecordset!CONCEPTO
DataReport1.Sections("Section1").Controls("label2").Caption = InputBox("NUMERO DE PARTIDA")
cEnLetras = CONVERTIR(TuRecordset!GTOT)
DataReport1.Sections("Section5").Controls("label22").Caption = cEnLetras
DataReport1.Show
End If
End With
Muchas Gracias