?? frmlr.frm
字號(hào):
VERSION 5.00
Object = "{00028C01-0000-0000-0000-000000000046}#1.0#0"; "DBGRID32.OCX"
Begin VB.Form Frmlr
BorderStyle = 1 'Fixed Single
Caption = "小小收支薄-收支瀏覽"
ClientHeight = 6015
ClientLeft = 45
ClientTop = 330
ClientWidth = 7365
Icon = "Frmlr.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6015
ScaleWidth = 7365
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton Comzc
Caption = "全選支出"
Height = 300
Left = 5670
TabIndex = 26
Top = 4470
Width = 1530
End
Begin VB.CommandButton Comsl
Caption = "全選收入"
Height = 300
Left = 5670
TabIndex = 25
Top = 4095
Width = 1530
End
Begin VB.CommandButton Command1
Caption = "刷新列表"
Height = 360
Left = 750
TabIndex = 24
Top = 5385
Width = 1470
End
Begin VB.CheckBox Check1
Caption = "其它支出"
Height = 270
Index = 9
Left = 4515
TabIndex = 23
Top = 4485
Width = 1050
End
Begin VB.CheckBox Check1
Caption = "投資支出"
Height = 270
Index = 8
Left = 3435
TabIndex = 22
Top = 4470
Width = 1050
End
Begin VB.CheckBox Check1
Caption = "學(xué)習(xí)支出"
Height = 270
Index = 7
Left = 2325
TabIndex = 21
Top = 4485
Width = 1050
End
Begin VB.CheckBox Check1
Caption = "娛樂支出"
Height = 270
Index = 6
Left = 1230
TabIndex = 20
Top = 4470
Width = 1050
End
Begin VB.CheckBox Check1
Caption = "生活支出"
Height = 270
Index = 5
Left = 120
TabIndex = 19
Top = 4470
Width = 1050
End
Begin VB.CheckBox Check1
Caption = "其它收入"
Height = 270
Index = 4
Left = 4500
TabIndex = 18
Top = 4140
Width = 1050
End
Begin VB.CheckBox Check1
Caption = "打工收入"
Height = 270
Index = 3
Left = 3420
TabIndex = 17
Top = 4140
Width = 1050
End
Begin VB.CheckBox Check1
Caption = "福利收入"
Height = 270
Index = 2
Left = 2325
TabIndex = 16
Top = 4140
Width = 1050
End
Begin VB.CheckBox Check1
Caption = "獎(jiǎng)金收入"
Height = 270
Index = 1
Left = 1215
TabIndex = 15
Top = 4125
Width = 1050
End
Begin VB.CheckBox Check1
Caption = "工資收入"
Height = 270
Index = 0
Left = 120
TabIndex = 14
Top = 4125
Width = 1050
End
Begin VB.CommandButton Comexit
Caption = "返回"
Height = 390
Left = 4755
TabIndex = 13
Top = 5340
Width = 1470
End
Begin VB.TextBox Textzf
Height = 285
Left = 5685
Locked = -1 'True
TabIndex = 10
Top = 4950
Width = 1500
End
Begin VB.TextBox Textsl
Height = 285
Left = 1980
Locked = -1 'True
TabIndex = 9
Top = 4950
Width = 1500
End
Begin VB.TextBox Textmaxmon
Height = 270
Left = 6255
TabIndex = 8
Text = "Text4"
Top = 3690
Width = 1050
End
Begin VB.TextBox Textminmon
Height = 270
Left = 5040
TabIndex = 7
Text = "Text3"
Top = 3690
Width = 1005
End
Begin VB.TextBox Textmaxdate
Height = 270
Left = 2760
TabIndex = 6
Text = "Text2"
Top = 3690
Width = 1230
End
Begin VB.TextBox Textmindate
Height = 270
Left = 1305
TabIndex = 5
Text = "Text1"
Top = 3690
Width = 1140
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 'DefaultCursor
DefaultType = 2 'UseODBC
Exclusive = 0 'False
Height = 345
Left = 4995
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "xb"
Top = 5325
Visible = 0 'False
Width = 1410
End
Begin MSDBGrid.DBGrid DBGridlr
Bindings = "Frmlr.frx":0442
Height = 3570
Left = 0
OleObjectBlob = "Frmlr.frx":0452
TabIndex = 0
Top = 0
Width = 7365
End
Begin VB.Label Label6
Caption = "所顯示記錄的支付總額"
Height = 195
Left = 3780
TabIndex = 12
Top = 4995
Width = 1905
End
Begin VB.Label Label5
Caption = "所顯示記錄的收入總額"
Height = 240
Left = 90
TabIndex = 11
Top = 4995
Width = 1905
End
Begin VB.Label Label4
Caption = "至"
Height = 195
Left = 6075
TabIndex = 4
Top = 3735
Width = 150
End
Begin VB.Label Label3
Caption = "收支金額從"
Height = 195
Left = 4140
TabIndex = 3
Top = 3735
Width = 960
End
Begin VB.Label Label2
Caption = "到"
Height = 195
Left = 2475
TabIndex = 2
Top = 3735
Width = 195
End
Begin VB.Label Label1
Caption = "瀏覽收支日期從從"
Height = 195
Left = 45
TabIndex = 1
Top = 3735
Width = 1275
End
End
Attribute VB_Name = "Frmlr"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
'Download by http://www.codefans.net
Attribute VB_Exposed = False
Option Explicit
Private dbzb As Database, relr As Recordset
Private Sub Comexit_Click()
Unload Me
'frmxb.Show
End Sub
Private Sub Command1_Click()
Dim i As Integer, lb(10) As String
Dim t As Integer, sd As String
If CDate(Textmaxdate.Text) < CDate(Textmindate.Text) Then
MsgBox "后面的日期應(yīng)大于前面的!" + Chr(13) + "為了選出您想要的記錄請(qǐng)修改過來.", 48, "日期錯(cuò)誤"
Textmaxdate.SelStart = 0
Textmaxdate.SelLength = 8
Textmaxdate.SetFocus
Exit Sub
End If
If Val(Textmaxmon.Text) < Val(Textminmon.Text) Then
MsgBox "后面的金額應(yīng)大于前面的!" + Chr(13) + "為了選出您想要的記錄請(qǐng)修改過來.", 48, "金額錯(cuò)誤"
Textmaxmon.SelStart = 0
Textmaxmon.SelLength = 10
Textmaxmon.SetFocus
Exit Sub
End If
t = 0
For i = 1 To 10
lb(i) = Check1(i - 1).Caption
Next i
sd = ""
For i = 1 To 10
If Check1(i - 1).Value = 1 Then
If Len(sd) <> 0 Then
sd = sd + "'or 類別='" + lb(i)
Else
sd = lb(i)
End If
End If
Next i
sd = "( 類別='" + sd + "')"
'下面是以前用的笨方法,但上面的方法也是在搞懂下面這句才能想通的.
'sd = " (類別='" + lb(0) + "' or 類別='" + lb(1) + "' or 類別='" + lb(2) + "' or 類別='" + lb(3) + "' or 類別='" + lb(4) + "' or 類別='" + lb(5) + "' or 類別='" + lb(6) + "' or 類別='" + lb(7) + "' or 類別='" + lb(8) + "' or 類別='" + lb(9) + "')"
Data1.RecordSource = "select * from xb where " + sd + " and [收支日期]>=cdate(" + "'" + Trim(Textmindate.Text) + "'" + ") and [收支日期]<=cdate(" + "'" + Trim(Textmaxdate.Text) + "'" + ")and [收支金額]>=" + Textminmon.Text + " and [收支金額]<=" + Textmaxmon.Text + " ORDER BY [收支日期] ASC"
'雖然TEXT是字符但仍要在括號(hào)中加單引號(hào)才能正確計(jì)算
Data1.Refresh
Set relr = dbzb.OpenRecordset("select sum(收支金額) from xb where mid(類別,3,2)='收入' and " + sd + " and [收支日期]>=cdate(" + "'" + Trim(Textmindate.Text) + "'" + ") and [收支日期]<=cdate(" + "'" + Trim(Textmaxdate.Text) + "'" + ")and [收支金額]>=" + Textminmon.Text + " and [收支金額]<=" + Textmaxmon.Text)
Textsl.Text = Format(relr.Fields(0), "currency")
Set relr = dbzb.OpenRecordset("select sum(收支金額) from xb where mid(類別,3,2)='支出' and " + sd + " and [收支日期]>=cdate(" + "'" + Trim(Textmindate.Text) + "'" + ") and [收支日期]<=cdate(" + "'" + Trim(Textmaxdate.Text) + "'" + ")and [收支金額]>=" + Textminmon.Text + " and [收支金額]<=" + Textmaxmon.Text)
Textzf.Text = Format(relr.Fields(0), "currency")
End Sub
Private Sub Comsl_Click()
Static t As Byte
Dim i As Integer
If t = 0 Then
t = 1
For i = 0 To 4
Check1(i).Value = 1
Next i
Comsl.Caption = "不選收入"
Else
t = 0
For i = 0 To 4
Check1(i).Value = 0
Next i
Comsl.Caption = "全選收入"
End If
End Sub
Private Sub Comzc_Click()
Static t As Byte
Dim i As Integer
If t = 0 Then
t = 1
For i = 5 To 9
Check1(i).Value = 1
Next i
Comzc.Caption = "不選支出"
Else
t = 0
For i = 5 To 9
Check1(i).Value = 0
Next i
Comzc.Caption = "全選支出"
End If
End Sub
Private Sub Form_Activate()
Me.Caption = "小小收支薄-收支瀏覽" + "(" + frmxb.myyear + "年度)"
Data1.DatabaseName = App.Path + "\zb.mdb"
Data1.RecordSource = ("select * from xb where year(收支日期)='" + frmxb.myyear + "'")
Set dbzb = OpenDatabase(App.Path + "\zb.mdb")
Set relr = dbzb.OpenRecordset("select min(收支日期),max(收支日期),min(收支金額),max(收支金額) from xb where year(收支日期)='" + frmxb.myyear + "'")
Textmindate.Text = relr.Fields(0)
Textmaxdate.Text = relr.Fields(1)
Textminmon.Text = relr.Fields(2)
Textmaxmon.Text = relr.Fields(3)
'Set relr = dbzb.OpenRecordset("select sum(收支金額) from xb where (收支標(biāo)志=true and year(收支日期)='" + frmxb.myyear + "')")
'Textsl.Text = Format(relr.Fields(0), "currency")
'Set relr = dbzb.OpenRecordset("select sum(收支金額) from xb where (收支標(biāo)志=false and year(收支日期)='" + frmxb.myyear + "')")
'Textzf.Text = Format(relr.Fields(0), "currency")
End Sub
Private Sub Textmindate_LostFocus()
If Not IsDate(Textmindate.Text) Then
Textmindate.SelStart = 0
Textmindate.SelLength = 8
Textmindate.SetFocus
End If
End Sub
Private Sub Textmaxdate_LostFocus()
If Not IsDate(Textmaxdate.Text) Then
Textmaxdate.SelStart = 0
Textmaxdate.SelLength = 8
Textmaxdate.SetFocus
' Exit Sub
End If
End Sub
Private Sub Textminmon_LostFocus()
If Not IsNumeric(Textminmon.Text) Then
Textminmon.SetFocus
Textminmon.SelStart = 0
Textminmon.SelLength = Len(Textminmon.Text)
End If
End Sub
Private Sub Textmaxmon_LostFocus()
If Not IsNumeric(Textmaxmon.Text) Then
Textmaxmon.SetFocus
Textmaxmon.SelStart = 0
Textmaxmon.SelLength = Len(Textmaxmon.Text)
'Exit Sub
End If
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -