代码
Private Sub btnHandover_Click()
On Error GoTo ErrorHandler
Dim strWhere As String
Dim strMsg As String
Dim iQty1 As Long
Dim iQtx1 As Currency
Dim iQty2 As Long
Dim iQtx2 As Currency
Dim iQty3 As Long
Dim iQtx3 As Currency
Dim strUserName As String
strUserName = GetParameter("Current User NickName", [dbText], Null)
If Me.sfrList.Form.CurrentRecord < 1 Then
Exit Sub
End If
If Me.cbo统计方式 <> "" Then strWhere = strWhere & " AND 结算单位=" & SQLText(Me.cbo统计方式)
If Me.txt开始日期 <> "" Then strWhere = strWhere & " AND 结算日期>=" & SQLDate(Me.txt开始日期, "#")
If Me.txt截止日期 <> "" Then strWhere = strWhere & " AND 结算日期<=" & SQLDate(Me.txt截止日期, "#")
strWhere = strWhere & " AND 处理标记= '待移交'"
iQty1 = Nz(DCount("*", "城乡居民补医结算信息表", strWhere), 0)
iQtx1 = Nz(DSum("结算金额合计", "城乡居民补医结算信息表", strWhere), 0)
iQty2 = Nz(DCount("*", "城镇居民补医结算信息表", strWhere), 0)
iQtx2 = Nz(DSum("结算金额合计", "城镇居民补医结算信息表", strWhere), 0)
iQty3 = Nz(DCount("*", "城镇职工补医结算信息表", strWhere), 0)
iQtx3 = Nz(DSum("结算金额合计", "城镇职工补医结算信息表", strWhere), 0)
If strWhere <> "" Then strWhere = " WHERE " & Mid(strWhere, 6)
Debug.Print strWhere
strMsg = "[" & Me.txt开始日期 & "]至[" & Me.txt截止日期 & "][" & Me.cbo统计方式 & "]待移交的记录:" & Chr(10) & "" _
& " 城乡居民补医记录共计[" & iQty1 & "]条、结算金额合计[" & iQtx1 & "]元; " & Chr(10) & "" _
& " 城镇居民补医记录共计[" & iQty2 & "]条、结算金额合计[" & iQtx2 & "]元;" & Chr(10) & "" _
& " 城镇职工补医记录共计[" & iQty3 & "]条、结算金额合计[" & iQtx3 & "]元;" & Chr(10) & "" _
& " 请逐笔核对录入是否正确,交接之后将不能再编辑记录,确定要完成交接吗?"
If MsgBox(strMsg, vbExclamation + vbOKCancel, "交接确认") = vbOK Then
If iQty1 > 0 Then DAORunSQL "UPDATE 城乡居民补医结算信息表 SET 处理标记= '待审核'" & strWhere
If iQty2 > 0 Then DAORunSQL "UPDATE 城镇居民补医结算信息表 SET 处理标记= '待审核'" & strWhere
If iQty3 > 0 Then DAORunSQL "UPDATE 城镇职工补医结算信息表 SET 处理标记= '待审核'" & strWhere
Call btn查询_Click
MsgBoxEx "交接完成!", vbInformation
End If
ExitHere:
Exit Sub
ErrorHandler:
Select Case Err.Number
Case Else
RDPErrorHandler Me.Name & ": Sub btnHandover_Click()"
End Select
Resume ExitHere
End Sub