Private Sub cmdQuery_Click()
Dim Sqlstr As String
Dim whrStr As String
Dim feeC As Double
Dim znjC As Double
Dim rstRg As New ADODB.Recordset
'拼Where 语句
whrStr = getWhrStr()
'取得网格的数据
Sqlstr = "select * from feels " & whrStr & " "
'MsgBox Sqlstr
If rsdg.State = 1 Then
rsdg.Close
End If
rsdg.Open Sqlstr, gCnn, adOpenStatic, adLockOptimistic
'Debug.Print Sqlstr
Set rsdg = getQueryData(Sqlstr)
Set dgexp.DataSource = rsdg
Sqlstr = " select sum(feeMoney),sum(Ecount) from feels " & whrStr & " "
If rstRg.State = 1 Then
rstRg.Close
End If
rstRg.Open Sqlstr, gCnn, adOpenStatic, adLockBatchOptimistic
txtCount = Format(rstRg.Fields(0), "####0.00") & " "
txtCountA = rstRg.Fields(1) & " "
rstRg.Close
MsgBox " 数据查询完成,共" & rsdg.RecordCount & " 条纪录!", vbInformation
End Sub
Private Function getWhrStr() As String
'功能描述:拼凑Where语句
'返回串值
Dim whrStr As String
'拼Where 语句
whrStr = "where 1 = 1 "
If Trim(Me.txtID) <> "" Then
whrStr = whrStr & " and holderid ='" & Trim(Me.txtID) & "' "
End If
If Trim(Me.txtUser) <> "" Then
whrStr = whrStr + " and holder like '%" & txtUser & "%'"
End If
If Trim(Me.txtMoney) <> "" Then
whrStr = whrStr + " and qianFee>= " & Me.txtMoney & ""
End If
whrStr = whrStr + " and Feedate>= #" & Me.dtpS & "# and Feedate<= #" & Me.dtpE & "# "
getWhrStr = whrStr
End Function
Private Sub cmdReturn_Click()
Unload Me
End Sub
Private Sub Form_Load()
dtpE.Value = Format(Now, "yyyy-mm-dd")
End Sub
Private Sub Form_Unload(Cancel As Integer)
If rsdg.State = 1 Then
rsdg.Close
End If
End Sub
11:费用查询界面设计:
费用查询代码设计:
Private Sub cmdExport_Click()
'导出网格数据到EXCEL中
Export rsdg, Me.dgexp, " 数据查询", Format(Now, "yyyy-mm-dd")
End Sub
Private Sub cmdQuery_Click()
Dim Sqlstr As String
Dim whrStr As String
Dim feeC As Double
Dim znjC As Double
'拼Where 语句
whrStr = getWhrStr()
'取得网格的数据 '2957387
Sqlstr = "select * from panelInfo " & whrStr & " "
'MsgBox Sqlstr
If rsdg.State = 1 Then
rsdg.Close
End If
rsdg.Open Sqlstr, gCnn, adOpenStatic, adLockOptimistic
Set rsdg = getQueryData(Sqlstr)
Set dgexp.DataSource = rsdg
MsgBox " 数据查询完成,共" & rsdg.RecordCount & " 条纪录!", vbInformation
End Sub
Private Function getWhrStr() As String
'功能描述:拼凑Where语句
'返回串值
Dim whrStr As String
'拼Where 语句
whrStr = "where 1 = 1 "
If Trim(Me.txtID) <> "" Then
whrStr = whrStr & " and holderid ='" & Trim(Me.txtID) & "' "
End If
If Trim(Me.txtUser) <> "" Then
whrStr = whrStr + " and holder like '%" & txtUser & "%'"
End If
If Trim(Me.txtMoney) <> "" Then
whrStr = whrStr + " and cFeeMoney>= " & Me.txtMoney & ""
End If
getWhrStr = whrStr
End Function
Private Sub cmdReturn_Click()
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
If rsdg.State = 1 Then
rsdg.Close
End If
End Sub
<< 上一页 [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] 下一页