Cita:
Iniciado por korg1988
y con respecto al otro problema que site ?
el de el datareport?(sigue siendo VB6 aclaro)
Hola korg,
En el diseño del DataReport colocas en la sección "Detalle" un rptTextBox no enlazado (Texto1) y en la sección de "Encabezado de grupo" lo mismo (Texto2).
Suponemos que el campo por el que quieres agrupar se llama "nombre" y el detalle "costo".
Código:
Private Sub Command1_Click()
Dim cmd As New ADODB.Command
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
cn.Open "Provider=MSDATASHAPE; Data Provider=Microsoft.JET.OLEDB.4.0;" & _
"Data Source=" & App.Path & "\BaseDeDatos.mdb"
With cmd
.ActiveConnection = cn
.CommandType = adCmdText
.CommandText = " SHAPE {" & "SELECT * FROM LaTabla" & "} AS Detalle Compute Detalle BY 'nombre'"
.Execute
End With
With rs
.ActiveConnection = cn
.CursorLocation = adUseClient
.Open cmd
End With
With DataReport1
Set .DataSource = rs
.DataMember = ""
With .Sections("Sección6").Controls ' Sección "Encabezado de Grupo"
.Item("Texto2").DataField = "nombre"
End With
With .Sections("Sección1").Controls ' Sección "Detalle"
.Item("Texto1").DataMember = "Detalle"
.Item("Texto1").DataField = "costo"
End With
.Refresh
.Show
End With
End Sub