📄 frmshru.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form Form3
Caption = "查询范围"
ClientHeight = 6495
ClientLeft = 60
ClientTop = 555
ClientWidth = 8385
LinkTopic = "Form3"
MaxButton = 0 'False
ScaleHeight = 6495
ScaleWidth = 8385
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command21
Caption = "指 定 日 期 查 询"
Height = 615
Left = 3000
TabIndex = 26
Top = 4800
Visible = 0 'False
Width = 2295
End
Begin VB.CommandButton Command20
Caption = "全 部"
Height = 495
Left = 3240
TabIndex = 25
Top = 1920
Visible = 0 'False
Width = 1575
End
Begin VB.CommandButton Command19
Caption = "去 年"
Height = 495
Left = 5880
TabIndex = 24
Top = 1200
Visible = 0 'False
Width = 1575
End
Begin VB.CommandButton Command18
Caption = "本 年"
Height = 495
Left = 4080
TabIndex = 23
Top = 1200
Visible = 0 'False
Width = 1575
End
Begin VB.CommandButton Command17
Caption = "上 月"
Height = 495
Left = 2280
TabIndex = 22
Top = 1200
Visible = 0 'False
Width = 1575
End
Begin VB.CommandButton Command16
Caption = "本 月"
Height = 495
Left = 480
TabIndex = 21
Top = 1200
Visible = 0 'False
Width = 1575
End
Begin VB.CommandButton Command15
Caption = "上 周"
Height = 495
Left = 5880
TabIndex = 20
Top = 480
Visible = 0 'False
Width = 1575
End
Begin VB.CommandButton Command14
Caption = "本 周"
Height = 495
Left = 4080
TabIndex = 19
Top = 480
Visible = 0 'False
Width = 1575
End
Begin VB.CommandButton Command13
Caption = "昨 天"
Height = 495
Left = 2280
TabIndex = 18
Top = 480
Visible = 0 'False
Width = 1575
End
Begin VB.CommandButton Command12
Caption = "今 天"
Height = 495
Left = 480
TabIndex = 17
Top = 480
Visible = 0 'False
Width = 1575
End
Begin VB.CommandButton Command1
Caption = "退 出"
Height = 495
Left = 3240
TabIndex = 2
Top = 5880
Width = 1815
End
Begin VB.Frame Frame2
Caption = "选择时段"
Height = 2895
Left = 360
TabIndex = 1
Top = 2760
Width = 7695
Begin VB.CommandButton Command11
Caption = "指 定 日 期 查 询"
Height = 615
Left = 2640
TabIndex = 16
Top = 2040
Width = 2295
End
Begin MSComCtl2.DTPicker DT1
Height = 375
Left = 2280
TabIndex = 14
Top = 360
Width = 4335
_ExtentX = 7646
_ExtentY = 661
_Version = 393216
Format = 25362433
CurrentDate = 38972
End
Begin MSComCtl2.DTPicker DT2
Height = 375
Left = 2280
TabIndex = 15
Top = 1200
Width = 4335
_ExtentX = 7646
_ExtentY = 661
_Version = 393216
Format = 25362433
CurrentDate = 38972
End
Begin VB.Label Label2
Alignment = 2 'Center
BorderStyle = 1 'Fixed Single
Caption = "终止时间:"
Height = 495
Left = 360
TabIndex = 13
Top = 1200
Width = 1575
End
Begin VB.Label Label1
Alignment = 2 'Center
BorderStyle = 1 'Fixed Single
Caption = "开始时间:"
Height = 495
Left = 360
TabIndex = 12
Top = 360
Width = 1575
End
End
Begin VB.Frame Frame1
Caption = "固定时段"
Height = 2535
Left = 360
TabIndex = 0
Top = 120
Width = 7695
Begin VB.CommandButton Command10
Caption = "全 部"
Height = 495
Left = 2880
TabIndex = 11
Top = 1800
Width = 1575
End
Begin VB.CommandButton Command9
Caption = "去 年"
Height = 495
Left = 5520
TabIndex = 10
Top = 1080
Width = 1575
End
Begin VB.CommandButton Command8
Caption = "本 年"
Height = 495
Left = 3720
TabIndex = 9
Top = 1080
Width = 1575
End
Begin VB.CommandButton Command7
Caption = "上 月"
Height = 495
Left = 1920
TabIndex = 8
Top = 1080
Width = 1575
End
Begin VB.CommandButton Command6
Caption = "本 月"
Height = 495
Left = 120
TabIndex = 7
Top = 1080
Width = 1575
End
Begin VB.CommandButton Command5
Caption = "上 周"
Height = 495
Left = 5520
TabIndex = 6
Top = 360
Width = 1575
End
Begin VB.CommandButton Command4
Caption = "本 周"
Height = 495
Left = 3720
TabIndex = 5
Top = 360
Width = 1575
End
Begin VB.CommandButton Command3
Caption = "昨 天"
Height = 495
Left = 1920
TabIndex = 4
Top = 360
Width = 1575
End
Begin VB.CommandButton Command2
Caption = "今 天"
Height = 495
Left = 120
TabIndex = 3
Top = 360
Width = 1575
End
End
End
Attribute VB_Name = "Form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Function test(ByVal mdate As Date) As Long
Dim i As Long
i = Weekday(mdate, vbMonday)
test = i
End Function
Private Sub Command1_Click()
Unload Form3
End Sub
Private Sub Command10_Click()
Form2.Ad2.RecordSource = "select * from slb "
Form2.Ad2.Refresh
Form2.Label1 = "全 部 收 入 情 况"
Unload Form3
End Sub
Private Sub Command11_Click()
Dim s As String
If DT2.Value < DT1.Value Then
MsgBox "后面的日期应大于前面的!"
DT2.SetFocus
Exit Sub
End If
Form2.Label1 = "从" & DT1.Value & "到" & DT2.Value & "的收入"
s = "select * from slb where 收入日期>=#" & DT1.Value & "# and 收入日期<=#" & DT2.Value & "# ORDER BY 收入日期 ASC"
Form2.Ad2.RecordSource = s
Form2.Ad2.Refresh
Unload Form3
End Sub
Private Sub Command12_Click()
Dim m As String
m = "select * from zcb where 支出日期=#" & Date & "#"
Form2.Ad2.RecordSource = m
Form2.Ad2.Refresh
Unload Form3
Form2.Label1.Caption = "今 天 的 支 出"
End Sub
Private Sub Command13_Click()
Dim m As String
m = "select * from zcb where 支出日期=#" & Date - 1 & "#"
Form2.Ad2.RecordSource = m
Form2.Ad2.Refresh
Unload Form3
Form2.Label1.Caption = "昨 天 的 支 出"
End Sub
Private Sub Command14_Click()
Dim mdate As Date
Dim d As String
mdate = Now
d = "select * from zcb where 支出日期>=#" & Date - test(mdate) + 1 & "# and 支出日期<=#" & Date - test(mdate) + 7 & "# ORDER BY 支出日期 ASC"
Form2.Ad2.RecordSource = d
Form2.Ad2.Refresh
Unload Form3
Form2.Label1 = "从" & Date - test(mdate) + 1 & "到" & Date - test(mdate) + 7 & "的支 出"
End Sub
Private Sub Command15_Click()
Dim mydate As Date
Dim n As String
mydate = Now
n = "select * from zcb where 支出日期>=#" & Date - test(mydate) - 7 & "# and 支出日期<=#" & Date - test(mydate) + 1 & "# ORDER BY 支出日期 ASC"
Form2.Ad2.RecordSource = n
Form2.Ad2.Refresh
Unload Form3
Form2.Label1 = "从" & Date - test(mydate) - 6 & "到" & Date - test(mydate) & "的支 出"
End Sub
Private Sub Command16_Click()
Dim Y As Integer
Y = Month(Now)
Dim o As String
o = "select * from zcb where month(支出日期)=" & Y & " "
Form2.Ad2.RecordSource = o
Form2.Ad2.Refresh
Unload Form3
Form2.Label1 = "" & Y & " 月 的 支 出"
End Sub
Private Sub Command17_Click()
Dim s As Integer
s = Month(Now)
Dim o As String
o = "select * from zcb where month(支出日期)=" & s - 1 & " "
Form2.Ad2.RecordSource = o
Form2.Ad2.Refresh
Unload Form3
Form2.Label1 = "" & s - 1 & " 月 的 支 出"
End Sub
Private Sub Command18_Click()
Dim s As Integer
s = Year(Now)
Dim o As String
o = "select * from zcb where year(支出日期)=" & s & " "
Form2.Ad2.RecordSource = o
Form2.Ad2.Refresh
Unload Form3
Form2.Label1 = "" & s & " 年 的 支 出"
End Sub
Private Sub Command19_Click()
Dim s As Integer
s = Year(Now)
Dim o As String
o = "select * from zcb where year(支出日期)=" & s - 1 & " "
Form2.Ad2.RecordSource = o
Form2.Ad2.Refresh
Unload Form3
Form2.Label1 = "" & s - 1 & " 年 的 支 出"
End Sub
Private Sub Command2_Click()
Dim m As String
m = "select * from zcb where 收入日期=#" & Date & "#"
Form2.Ad2.RecordSource = m
Form2.Ad2.Refresh
Unload Form3
Form2.Label1.Caption = "今 天 的 收 入"
End Sub
Private Sub Command20_Click()
Form2.Ad2.RecordSource = "select * from zcb"
Form2.Ad2.Refresh
Form2.Label1 = "全 部 支 出 情 况"
Unload Form3
End Sub
Private Sub Command21_Click()
Dim s As String
If DT2.Value < DT1.Value Then
MsgBox "后面的日期应大于前面的!"
DT2.SetFocus
Exit Sub
End If
Form2.Label1 = "从" & DT1.Value & "到" & DT2.Value & "的支出"
s = "select * from zcb where 支出日期>=#" & DT1.Value & "# and 支出日期<=#" & DT2.Value & "# ORDER BY 支出日期 ASC"
Form2.Ad2.RecordSource = s
Form2.Ad2.Refresh
Unload Form3
End Sub
Private Sub Command3_Click()
Dim m As String
m = "select * from slb where 收入日期=#" & Date - 1 & "#"
Form2.Ad2.RecordSource = m
Form2.Ad2.Refresh
Unload Form3
Form2.Label1.Caption = "昨 天 的 收 入"
End Sub
Private Sub Command4_Click()
Dim mdate As Date
Dim d As String
mdate = Now
d = "select * from slb where 收入日期>=#" & Date - test(mdate) + 1 & "# and 收入日期<=#" & Date - test(mdate) + 7 & "# ORDER BY 收入日期 ASC"
Form2.Ad2.RecordSource = d
Form2.Ad2.Refresh
Unload Form3
Form2.Label1 = "从" & Date - test(mdate) + 1 & "到" & Date - test(mdate) + 7 & "的收入"
End Sub
Private Sub Command5_Click()
Dim mydate As Date
Dim n As String
mydate = Now
n = "select * from slb where 收入日期>=#" & Date - test(mydate) - 7 & "# and 收入日期<=#" & Date - test(mydate) + 1 & "# ORDER BY 收入日期 ASC"
Form2.Ad2.RecordSource = n
Form2.Ad2.Refresh
Unload Form3
Form2.Label1 = "从" & Date - test(mydate) - 6 & "到" & Date - test(mydate) & "的收入"
End Sub
Private Sub Command6_Click()
Dim Y As Integer
Y = Month(Now)
Dim o As String
o = "select * from slb where month(收入日期)=" & Y & " "
Form2.Ad2.RecordSource = o
Form2.Ad2.Refresh
Unload Form3
Form2.Label1 = "" & Y & " 月 的 收 入"
End Sub
Private Sub Command7_Click()
Dim s As Integer
s = Month(Now)
Dim o As String
o = "select * from slb where month(收入日期)=" & s - 1 & " "
Form2.Ad2.RecordSource = o
Form2.Ad2.Refresh
Unload Form3
Form2.Label1 = "" & s - 1 & " 月 的 收 入"
End Sub
Private Sub Command8_Click()
Dim s As Integer
s = Year(Now)
Dim o As String
o = "select * from slb where year(收入日期)=" & s & " "
Form2.Ad2.RecordSource = o
Form2.Ad2.Refresh
Unload Form3
Form2.Label1 = "" & s & " 年 的 收 入"
End Sub
Private Sub Command9_Click()
Dim s As Integer
s = Year(Now)
Dim o As String
o = "select * from slb where year(收入日期)=" & s - 1 & " "
Form2.Ad2.RecordSource = o
Form2.Ad2.Refresh
Unload Form3
Form2.Label1 = "" & s - 1 & " 年 的 收 入"
End Sub
Private Sub Form_Load()
DT2.Value = Date
DT1.Value = Date
Form2.DG2.Visible = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -