VB程序员博客

VB程序开发

问题:水晶报表已经设置好了,但在vb程序中如何显示出这个报表,请高人指点,新手还请明示。        Getmarg "", "tj.rpt"
        FrmRpt!Report1.SelectionFormula = "{pjx.glid}=" & Val(glid) & " and {pjx.username}='" & ComputerName & "'"
        FrmRpt!Report1.Formulas(0) = "a='" & Zcdwname & "统计表" & "'"
        FrmRpt!Report1.Formulas(1) = "dw='" & Zcdwname & "'"
        FrmRpt!Report1.Destination = 0
        On Error Resume Next
        FrmRpt!Report1.Action = 1

Sub Getmarg(title As String, filename As String)
    Dim ssn As New ADODB.Recordset
    ssn.Open "select * from report where title='" & title & "' and printer_type='" & PrinterSet & "'", cn
    If Not ssn.EOF Then
        FrmRpt!Report1.ReportFileName = ReportPath & ssn("filename")
        FrmRpt!Report1.MarginLeft = ssn("marginleft")
        FrmRpt!Report1.MarginTop = ssn("margintop")
    Else
        FrmRpt!Report1.ReportFileName = ReportPath & filename
    End If
    FrmRpt!Report1.Connect = "DSN=" & DsnName & ";UID=" & DatabaseLoginUid & ";PWD=" & DatabaseUserPwd & ";"
    ssn.Close: Set ssn = Nothing
End Sub

标签: , , ,