北京 | 上海 | 天津 | 重庆 | 广州 | 深圳 | 珠海 | 汕头 | 佛山 | 中山 | 东莞 | 南京 | 苏州 | 无锡 | 常州 | 南通 | 扬州 | 徐州 | 杭州 | 温州 | 宁波 | 台州 | 福州 | 厦门 | 泉州 | 龙岩 | 合肥 | 芜湖 | 成都 | 遂宁 | 长沙 | 株洲 | 湘潭 | 武汉 | 南昌 | 济南 | 青岛 | 烟台 | 潍坊 | 淄博 | 济宁 | 太原 | 郑州 | 石家庄 | 保定 | 唐山 | 西安 | 大连 | 沈阳 | 长春 | 昆明 | 兰州 | 哈尔滨 | 佳木斯 | 南宁 | 桂林 | 海口 | 贵阳 | 西宁 | 乌鲁木齐 | 包头 |
查询出来的数据,在打印预览里显示的还是“查询”上的原始数据
Option Compare Database
Option Explicit
Private mclsQuery As GeneralQuery
Private Sub btnExport_Click()
If Not Me.CX.Form.CurrentRecord > 0 Then Exit Sub
ExportToExcel DataForm:=Me.CX
End Sub
Private Sub btnPrint_Click()
Me.PrintReport acViewNormal
End Sub
Private Sub btnPrintPreview_Click()
Me.PrintReport acViewPreview
End Sub
Private Sub Command47_Click()
Dim rst As Object
Dim CSRQ As Date
Dim jsrq As Date
Dim strSQL As String
Me.Text40.Requery
Me.Text42.Requery
CSRQ = Form_HZCX.Text40
jsrq = Form_HZCX.Text42
strSQL = " SELECT '住院汇总' AS 减免类型 , COUNT ( ZYZFY ) AS 减免人次 , Round ( Sum ( ZYZFY ) , 2 ) AS 总费用 , Round ( Sum ( XNHBCJE ) , 2 ) AS 医保补偿费用 , Round ( Sum ( QTBCJE ) , 2 ) " & _
" AS 其它补偿费用 , Round ( Sum ( BCJMFY ) , 2 ) AS 减免费用 , Round ( Sum ( GRZFJE ) , 2 ) AS 个人自付费用 " & _
" FROM FYMX WHERE FYMX.HSSJ > # " & CSRQ & " # And FYMX.HSSJ < # " & jsrq & " # union SELECT '慢病汇总' AS 减免类型 , COUNT([MZZFY]) AS 减免人次 , Round ( Sum ( MZZFY ) , 2 ) " & _
" AS 总费用 , Round ( Sum ( XNHBCJE ) , 2 ) AS 医保补偿费用 , ( 0 ) AS 其它补偿费用 , Round ( Sum ( BCJMFY ) , 2 ) AS 减免费用 , " & _
" Round ( Sum ( GRZFJE ) , 2 ) AS 个人自付费用 FROM FPMBJM WHERE FPMBJM.HSSJ > # " & CSRQ & " # And FPMBJM.HSSJ < # " & jsrq & " # union " & _
" SELECT '门诊汇总' AS 减免类型 , COUNT([MZZFY]) AS 减免人次 , Round ( Sum ( MZZFY ) , 2 ) AS 总费用 , Round ( Sum ( XNHBCJE ) , 2 ) AS 医保补偿费用 , ( 0 ) AS 其它补偿费用 , " & _
" Round ( Sum ( BCJMFY ) , 2 ) AS 减免费用 , Round ( Sum ( GRZFJE ) , 2 ) AS 个人自付费用 FROM FPMZJM WHERE " & _
" FPMZJM.HSSJ > # " & CSRQ & " # And FPMZJM.HSSJ < # " & jsrq & " # "
Me.CX.Form.RecordSource = strSQL
Me.Refresh
End Sub
Private Sub Command53_Click()
Dim rst As Object
Dim CSRQ As Date
Dim jsrq As Date
Dim strSQL As String
Me.Text40.Requery
Me.Text42.Requery
CSRQ = Form_HZCX.Text40
jsrq = Form_HZCX.Text42
strSQL = " SELECT '扶贫住院汇总' AS 减免类型 , COUNT ( ZYZFY ) AS 减免人次 , Round ( Sum ( ZYZFY ) , 2 ) AS 总费用 , Round ( Sum ( XNHBCJE ) , 2 ) AS 医保补偿费用 , Round ( Sum ( QTBCJE ) , 2 ) " & _
" AS 其它补偿费用 , Round ( Sum ( BCJMFY ) , 2 ) AS 减免费用 , Round ( Sum ( GRZFJE ) , 2 ) AS 个人自付费用 " & _
" FROM FYMX WHERE FYMX.HSSJ > # " & CSRQ & " # And FYMX.HSSJ < # " & jsrq & " # union SELECT '扶贫慢病汇总' AS 减免类型 , COUNT([MZZFY]) AS 减免人次 , Round ( Sum ( MZZFY ) , 2 ) " & _
" AS 总费用 , Round ( Sum ( XNHBCJE ) , 2 ) AS 医保补偿费用 , ( 0 ) AS 其它补偿费用 , Round ( Sum ( BCJMFY ) , 2 ) AS 减免费用 , " & _
" Round ( Sum ( GRZFJE ) , 2 ) AS 个人自付费用 FROM FPMBJM WHERE FPMBJM.HSSJ > # " & CSRQ & " # And FPMBJM.HSSJ < # " & jsrq & " # union " & _
" SELECT '扶贫门诊汇总' AS 减免类型 , COUNT([MZZFY]) AS 减免人次 , Round ( Sum ( MZZFY ) , 2 ) AS 总费用 , Round ( Sum ( XNHBCJE ) , 2 ) AS 医保补偿费用 , ( 0 ) AS 其它补偿费用 , " & _
" Round ( Sum ( BCJMFY ) , 2 ) AS 减免费用 , Round ( Sum ( GRZFJE ) , 2 ) AS 个人自付费用 FROM FPMZJM WHERE " & _
" FPMZJM.HSSJ > # " & CSRQ & " # And FPMZJM.HSSJ < # " & jsrq & " # union SELECT ' 签约服务汇总 ' AS 减免类型 , COUNT ( ZYZFY ) AS 减免人次 , Round ( Sum ( ZYZFY ) , 2 ) AS 总费用 , " & _
" Round ( Sum ( NHBCFY ) , 2 ) AS 医保补偿费用 , Round ( Sum ( QTBCFY ) , 2 ) AS 其它补偿费用 , Round ( Sum ( QYJMFY ) " & _
" , 2 ) AS 减免费用 , Round ( Sum ( ZZZFFY ) , 2 ) AS 个人自付费用 FROM 表1 WHERE 表1.JMRQ > # " & CSRQ & " # And " & _
" 表1.JMRQ < # " & jsrq & " # UNION SELECT ' 民政优抚汇总 ' AS 减免类型 , COUNT ( ZYZFY ) AS 减免人次 , Round ( Sum " & _
" ( ZYZFY ) , 2 ) AS 总费用 , Round ( Sum ( YBBXFY ) , 2 ) AS 医保补偿费用 , Round ( Sum ( QTBCFY ) , 2 ) " & _
" AS 其它补偿费用 , Round ( Sum ( MZBCFY ) , 2 ) AS 减免费用 , Round ( Sum ( GRFDFY ) , 2 ) AS 个人自付费用 " & _
" FROM YFBX WHERE YFBX.BXRQ > # " & CSRQ & " # And YFBX.BXRQ < # " & jsrq & " # "
Me.CX.Form.RecordSource = strSQL
Me.Refresh
End Sub
Public Function PrintReport(View As AcView)
On Error GoTo ErrorHandler
Dim strWhere As String
If Me.CX.Form.FilterOn Then
strWhere = Replace(Me.CX.Form.Filter, "[" & Me.CX.Form.Name & "].", "")
End If
DoCmd.OpenReport "rptHZCX", View, , strWhere
ExitHere:
Exit Function
ErrorHandler:
Select Case Err.Number
Case errOpenActionWasCanceled, errOperationCanceledByUser
Case Else
RDPErrorHandler Me.Name & ": Sub PrintReport()"
End Select
End Function