'*********************************************************
'* 名称:ReportPrint
'* 功能:通用报表打印设置
'* 用法:ReportPrint 命令名,SQL查询语句,报表名
'*********************************************************
Public Sub ReportPrint(ComName As String, SQLtxt As String, DrName As DataReport)
    With DE_Report
        .Commands(ComName).ActiveConnection = DE_Report.Con_report
        .Commands(ComName).CommandType = adCmdText
        .Commands(ComName).CommandText = SQLtxt
        .Commands(ComName).Execute
    End With
    Set DrName.DataSource = DE_Report
    DrName.DataMember = DE_Report.Commands(ComName).Name
End Sub   '调用如下 
    Dim sqlprint As String
    sqlprint = "SELECT * FROM dm_users where staffcode=141"
ReportPrint "com_Dzgl_jzxtyd", sqlprint, DR_Dzgl_Jzxtyd