📄 frmfeefind1.frm
字号:
EndProperty
BeginProperty Column04
ColumnWidth = 1544.882
EndProperty
BeginProperty Column05
ColumnWidth = 2055.118
EndProperty
EndProperty
End
End
Begin VB.Frame Frame1
BackColor = &H00C0C0C0&
Caption = "查询条件"
Height = 1335
Left = 120
TabIndex = 0
Top = 6120
Width = 8775
Begin CSCommand.Command cmdQuery
Height = 495
Left = 7200
TabIndex = 17
Top = 480
Width = 1095
_ExtentX = 1931
_ExtentY = 873
IconAlign = 0
Icon = "FrmFeefind1.frx":1E2A
Caption = "查询"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin MSComCtl2.DTPicker dtpS
Height = 375
Left = 1200
TabIndex = 9
Top = 240
Width = 1455
_ExtentX = 2566
_ExtentY = 661
_Version = 393216
Format = 20971521
CurrentDate = 38403
End
Begin VB.TextBox txtID
Appearance = 0 'Flat
Height = 300
Left = 3195
TabIndex = 3
Top = 840
Width = 900
End
Begin VB.TextBox txtUser
Appearance = 0 'Flat
Height = 300
Left = 1200
TabIndex = 2
Top = 840
Width = 945
End
Begin VB.TextBox txtMoney
Appearance = 0 'Flat
Height = 300
Left = 5760
TabIndex = 1
Top = 840
Width = 1020
End
Begin MSComCtl2.DTPicker dtpE
Height = 375
Left = 4200
TabIndex = 10
Top = 240
Width = 1455
_ExtentX = 2566
_ExtentY = 661
_Version = 393216
Format = 20971521
CurrentDate = 38403
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "结束日期"
Height = 180
Left = 3240
TabIndex = 12
Top = 240
Width = 720
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "开始日期"
Height = 255
Left = 240
TabIndex = 11
Top = 240
Width = 975
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "用户编号:"
Height = 180
Left = 2280
TabIndex = 6
Top = 840
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "用户名称:"
Height = 180
Left = 240
TabIndex = 5
Top = 840
Width = 900
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "应交金额(元):"
Height = 180
Left = 4320
TabIndex = 4
Top = 840
Width = 1260
End
End
Begin VB.Label Label7
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "总电量(度)"
Height = 180
Left = 120
TabIndex = 15
Top = 5760
Width = 900
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "总金额(元)"
Height = 180
Left = 3000
TabIndex = 13
Top = 5760
Width = 900
End
End
Attribute VB_Name = "frmFeefind"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rsdg As New ADODB.Recordset
Private Sub cmdExport_Click()
'导出网格数据到EXCEL中
Export rsdg, Me.dgexp, " 数据查询", "日期:" & Format(Now, "yyyy-mm-dd"), " 总电量:" & txtCountA & " 度 总金额:" & txtCount & " 元"
End Sub
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 姓名id ='" & Trim(Me.txtID) & "' "
End If
If Trim(Me.txtUser) <> "" Then
whrStr = whrStr + " and 姓名 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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -