Ver Mensaje Individual
  #8 (permalink)  
Antiguo 31/05/2010, 10:29
Avatar de abrahamvj
abrahamvj
 
Fecha de Ingreso: julio-2006
Ubicación: Lima, Peru
Mensajes: 708
Antigüedad: 17 años, 10 meses
Puntos: 18
Respuesta: crystal reports 11 vb6

Ya, te voy entendindo. Mira, la idea es crear el reporte con el asistente y luego ya con codigo vas enviandole los datos que desees. Mira y analiza esto, que va en el modulo del reporte CR:

Option Explicit
Private Report As Object


Private Sub Form_Resize()
CRViewer1.Top = 0
CRViewer1.Left = 0
CRViewer1.Height = ScaleHeight
CRViewer1.Width = ScaleWidth

End Sub

Private Sub Form_Load()

Dim rs As ADODB.Recordset, rs2 As ADODB.Recordset, rs3 As ADODB.Recordset
Dim strSQL As String

Set cnn = New ADODB.Connection

cnn.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & m_ruta & "\DatossistemaIDL.mdb" & ";" & _
"Jet OLEDB:Database Password=xxx"
cnn.Open

WindowState = 0
Screen.MousePointer = vbHourglass

Set Report = New CrystalReport1
Set rs = New ADODB.Recordset
Set rs2 = New ADODB.Recordset


If strreporte$ = "Area" Then
strSQL = "SELECT * FROM Actividades WHERE Area='" & strarea$ & "' AND Fecha Between #" & diainicial & "# AND #" & diafinal & "#"
ElseIf strreporte$ = "Responsable" Then
strSQL = "SELECT * FROM Actividades WHERE Responsable='" & strresponsable$ & "' AND Fecha Between #" & diainicial & "# AND #" & diafinal & "#"
End If

Set rs = New ADODB.Recordset
Set rs2 = New ADODB.Recordset
Set rs3 = New ADODB.Recordset

With rs
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open strSQL, cnn, , , adCmdText
End With

strSQL = "SELECT * FROM Lugares"

With rs2
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open strSQL, cnn, , , adCmdText
End With

strSQL = "SELECT * FROM TbltmpFin"

With rs3
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open strSQL, cnn, , , adCmdText
End With

With Report
.Database.SetDataSource rs
.OpenSubreport("Lugares").Database.SetDataSource rs2
.OpenSubreport("Financiamiento").Database.SetDataS ource rs3
.PaperOrientation = 1
.PaperSize = 9
.DiscardSavedData
End With

With CRViewer1
.EnableDrilldown = False
.DisplayGroupTree = False
.DisplayTabs = False
.EnableRefreshButton = True
.ReportSource = Report
.ViewReport
.Zoom (2)
End With

WindowState = 2
Screen.MousePointer = vbDefault

Set Report = Nothing

rs.Close
Set rs = Nothing
rs2.Close
Set rs2 = Nothing
rs3.Close
Set rs3 = Nothing


End Sub