Hiển thị kết quả từ 1 đến 2 / 2

Chủ đề: crystal report PROBLEM

  1. #1
    Tham gia
    19-08-2002
    Location
    hcm
    Bài viết
    37
    Like
    0
    Thanked 0 Times in 0 Posts

    crystal report PROBLEM

    có ai biết về crystal report không? Cho tôi hỏi thăm chút !
    Làm thế nào để nhúng 1 crystal report vào 1 form ( cho tôi biết code ).
    Gấp gấp nhé !
    Thanks !:
    Quote Quote

  2. #2
    Tham gia
    31-08-2002
    Location
    HO CHI MINH
    Bài viết
    20
    Like
    0
    Thanked 0 Times in 0 Posts

    Re: Crystal Report

    Van de cua ban la:
    1. Lam sao chay duoc mot file .rpt tu VB de tao bao cao
    2. Hien thi bao cao
    Voi 1. ban dung mot control CrystalReport (crystl32.ocx) dat duong dan file bao cao(property .ReportFileName ie "c:\myrpt.rpt"), connection (property .Connect), cach thuc tao bao cao (.Destination ie. crptToFile) cho no, neu bao cao co tham so thi dat tham so+gia tri vao .Destination .StoredProcParam cua no(.Destination nay kieu mang, 2 chieu: chieu 1 la index, chieu 2 la gia tri), dat kieu+ten file export (property .PrintFileType, .PrintFileName) sau do de tao bao cao thi dat .Action=1
    Voi 2. ban co tuy theo 1 ban export ra kieu file nao ma co hien thi tuong ung. Neu export ra kieu text ban co the su dung text box voi thuoc tinh (multi - line=true) de hien thi file da export, richtext thi su dung richtextbox,...
    Dac biet voi kieu la crystal report viewer thi ban co the su dung control cua no de view
    hoac su dung code nhu sau:
    Sub ShowReportFile()
    Dim strReportFile As String
    Dim FileName As String
    Dim intFile As String
    On Error GoTo ErrorHandler
    FileName = SelectedRpt
    FileName = FileName + sm.TellerID + EXT_RESULT_REPORT
    If Len(Dir(strDirResultReport + "\" + FileName)) = 0 Then
    fraPrgr.Visible = False
    DoEvents
    Msg "Kh«ng cã d÷ liÖu kÕt qu¶ b¸o c¸o", Caption
    Exit Sub
    End If
    '§äc d÷ liÖu
    intFile = FreeFile
    fraPrgr.Visible = True
    DoEvents
    Open strDirResultReport + "\" + FileName For Binary As #intFile
    strReportFile = Input(LOF(intFile), 1)
    Close (intFile)
    MousePointer = vbHourglass
    DoEvents
    If rptAutomation Is Nothing Then
    Set rptAutomation = CreateObject("Crystal.CRPE.Application")
    End If
    intFile = FreeFile
    FileName = GetShortNameRPT + sm.TellerID
    If Len(Dir(strDirResultReport + "\" + FileName)) > 0 Then
    SetAttr strDirResultReport + "\" + FileName, vbNormal
    Kill strDirResultReport + "\" + FileName
    End If
    strReportFile = UnCompressData(Decrypt(strReportFile, sm.TellerID))
    Open strDirResultReport + "\" + FileName For Binary As #intFile
    Put #intFile, , strReportFile
    Close #intFile
    Set rptReport = rptAutomation.OpenReport(strDirResultReport + "\" + FileName, 1)
    SetAttr strDirResultReport + "\" + FileName, vbNormal
    Kill strDirResultReport + "\" + FileName
    rptReport.EventInfo.ClosePrintWindowEventEnabled = True
    With rptReport.PrintWindowOptions
    .CanDrillDown = True
    .HasCancelButton = True
    .HasCloseButton = True
    .HasNavigationControls = True
    .HasPrintButton = LView.SelectedItem.SubItems(8) And 2 ^ RPT_RIGHT_PRINT
    .Ha***portButton = .HasPrintButton
    .HasPrintSetupButton = .HasPrintButton
    .HasProgressControls = True
    .HasRefreshButton = False
    .HasSearchButton = True
    .HasZoomControl = True
    .HasGroupTree = True
    End With
    rptReport.Options.ZoomMode = 0 '(0: Full Size,1: PageWidth,2: Whole Page
    On Error Resume Next
    rptWindow.Close
    On Error GoTo ErrorHandler
    Set rptWindow = rptReport.Preview(SelectedRptDesc, , , , , WS_MAXIMIZED).Parent
    'rptReport.PrintWindowOptions.HasGroupTree = True
    rptWindow.Views(1).ZoomPreviewWindow 100

    fraPrgr.Visible = False
    DoEvents
    MousePointer = vbDefault
    DoEvents
    Exit Sub
    ErrorHandler:
    Close #intFile
    fraPrgr.Visible = False
    MousePointer = vbDefault
    DoEvents
    Call ProcessError(DEF_RETURN_VALUE, Err.number, CLIENT_ERROR, _
    "SBPrint.frmAdhoc.ShowReportFile", Err.Description)
    End Sub


    Cheer

    :idea:

Bookmarks

Quy định

  • Bạn không thể tạo chủ đề mới
  • Bạn không thể trả lời bài viết
  • Bạn không thể gửi file đính kèm
  • Bạn không thể sửa bài viết của mình
  •