Visual Basic - Pregunta de Data REport

Life is soft - evento anual de software empresarial
 
Vista:

Pregunta de Data REport

Publicado por Gilberto (225 intervenciones) el 20/07/2005 02:56:05
Hola amigos..

He realizado reportes con el componente de data report, pero ahora me estoy volviendo loco con un encabezado de grupo que necesito.. no se como hacerlo funcionar... aunque se como agregarlo al formulario de informe...... no se como hacer para que los campos de encabezado me salgan en el encabezado de grupo y el resto de campos subordinados me salgan en la seccion de detalle..
Alguien me puede ayudar.. ???? De verdad gracias..

groval.
Este es el codigo que utilizo para los reportes..

Public Sub ReportePRESUPUESTO()
Set rstREPOPRESUPUESTO = New ADODB.Recordset
rstREPOPRESUPUESTO.CursorLocation = adUseClient
rstREPOPRESUPUESTO.Open strQueryPRESUPUESTO, cnn2, adOpenDynamic, adLockPessimistic
X = rstREPOPRESUPUESTO.RecordCount

With DRPresupuesto.Sections("Section1").Controls 'section1 mean that section you create in datareport

.Item("texto1").DataField = rstREPOPRESUPUESTO("municipio").Name
.Item("texto2").DataField = rstREPOPRESUPUESTO("Lugar").Name
.Item("texto4").DataField = rstREPOPRESUPUESTO("fechaAdicion").Name
.Item("texto5").DataField = rstREPOPRESUPUESTO("presupuestoAnual").Name
.Item("texto7").DataField = rstREPOPRESUPUESTO("REgalias").Name
' .Item("texto8").DataField = rstREPOPRESUPUESTO("ActividadEconomica").Name
.Item("texto6").DataField = rstREPOPRESUPUESTO("observaciones").Name
End With

With DRPresupuesto.Sections("Section2").Controls
.Item("etiqueta1").Caption = "Municipio"
.Item("etiqueta3").Caption = "Lugar"
.Item("etiqueta11").Caption = "Fecha Adicion"
.Item("etiqueta6").Caption = "Presupuesto"
.Item("etiqueta5").Caption = "Regalias"


End With

With DRPresupuesto.Sections("Section4").Controls
.Item("etiqueta9").Caption = strTituloInformePRESUPUESTO

End With

With DRPresupuesto.Sections("Section5").Controls
.Item("etiqueta13").Caption = "TOTAL REGISTROS IMPRESOS " & " " & X

.Item("Function1").DataField = rstREPOPRESUPUESTO("presupuestoAnual").Name
.Item("Function2").DataField = rstREPOPRESUPUESTO("Regalias").Name

End With

DRPresupuesto.Caption = strTituloInformePRESUPUESTO

Set DRPresupuesto.DataSource = rstREPOPRESUPUESTO

DRPresupuesto.Show

End Sub
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Pregunta de Data REport

Publicado por Cobox (2 intervenciones) el 16/02/2006 13:32:33
Tengo el mismo problema q tú, me interesa mucho q alguién nos explique como agregar datos en el Encabezado de Grupo sin que me salga el error de: "Las secciones del informe no coinciden con el origen de datos". Os pongo un ejemplo de mi código:

Private Sub BImprimir_Click()

Dim rst As ADODB.Recordset
Dim sql As String

Set rst = New ADODB.Recordset
sql = "SELECT Usuarios.Usuario, Usuarios.Contrasena, Usuarios.Nivel, PlantasGeograficas.Descripcion FROM PlantasGeograficas INNER JOIN Usuarios ON PlantasGeograficas.PlantaGeografica = Usuarios.Planta;"
rst.Open sql, BD, adOpenForwardOnly, adLockReadOnly
Set iUsuarios.DataSource = rst
With iUsuarios.Sections("Detalle").Controls
.Item("txtUsuario").DataField = rst.Fields.Item(0).Name
.Item("txtContrasena").DataField = rst.Fields.Item(1).Name
.Item("txtNivel").DataField = rst.Fields.Item(2).Name
End With

With iUsuarios.Sections("GPlanta").Controls
.Item("txtDescripcion").DataField = rst.Fields.Item(3).Name
End With
Load iUsuarios
iUsuarios.Show
End Sub

No se si el error está en la SQL ya que no pongo el Group by... pero si hay q ponerle como se debería hacer?
A ver si nos podeis ayudar....bye compays
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar