?? frmadd.frm
字號:
VERSION 5.00
Begin VB.Form Frmadd
BorderStyle = 1 'Fixed Single
Caption = "自動化設置"
ClientHeight = 5175
ClientLeft = 45
ClientTop = 330
ClientWidth = 6900
Icon = "Frmadd.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5175
ScaleWidth = 6900
StartUpPosition = 1 'CenterOwner
Begin VB.CommandButton Comexit
Caption = "返回"
Height = 360
Left = 2700
TabIndex = 17
Top = 4695
Width = 1575
End
Begin VB.TextBox Text2
DataField = "備注"
DataSource = "Data1"
Height = 540
Left = 1185
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 16
Top = 1605
Width = 4950
End
Begin VB.ComboBox Combo1
Height = 300
Left = 4530
Style = 2 'Dropdown List
TabIndex = 14
Top = 3915
Width = 1890
End
Begin VB.CommandButton Command3
Caption = "更改"
Height = 330
Left = 2820
TabIndex = 13
Top = 3885
Width = 1095
End
Begin VB.TextBox Text1
Height = 270
Left = 600
TabIndex = 10
Text = "1000"
Top = 3915
Width = 1860
End
Begin VB.CommandButton Command1
Caption = "增加新預定"
Height = 375
Left = 135
Style = 1 'Graphical
TabIndex = 9
Top = 2280
Width = 1200
End
Begin VB.CommandButton Command2
Caption = "刪除當前預定"
Height = 375
Left = 5475
TabIndex = 8
TabStop = 0 'False
Top = 2250
Width = 1230
End
Begin VB.TextBox Textdate
DataField = "日期"
DataSource = "Data1"
Height = 345
Left = 4335
TabIndex = 3
Text = "Text1"
Top = 525
Width = 1740
End
Begin VB.ComboBox 每月
DataField = "間隔范圍"
DataSource = "Data1"
Height = 300
Left = 1185
TabIndex = 2
Text = "每月"
Top = 1155
Width = 1530
End
Begin VB.ComboBox 工資收入
DataField = "類別"
DataSource = "Data1"
Height = 300
Left = 4380
TabIndex = 1
Text = "工資收入"
Top = 1140
Width = 1695
End
Begin VB.Data Data1
Caption = "輸入預定,以后可按要求自動添加。"
Connect = "Access"
DatabaseName = "C:\Program Files\DevStudio\VB\work\zb.mdb"
DefaultCursorType= 0 'DefaultCursor
DefaultType = 2 'UseODBC
Exclusive = 0 'False
Height = 345
Left = 1380
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "autoadd"
Top = 2280
Width = 4080
End
Begin VB.TextBox Textmon
DataField = "金額"
DataSource = "Data1"
Height = 345
Left = 1170
TabIndex = 0
Top = 525
Width = 1545
End
Begin VB.Line Line2
BorderColor = &H80000000&
BorderWidth = 2
X1 = 60
X2 = 6780
Y1 = 2880
Y2 = 2880
End
Begin VB.Line Line1
BorderColor = &H00808080&
BorderWidth = 2
X1 = 75
X2 = 6765
Y1 = 2910
Y2 = 2910
End
Begin VB.Label Label5
Caption = "更改某個月的上月結余金額(除非您在歡迎使用窗口中輸入了錯誤的資金后才需要更改上月結余)"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 435
Left = 105
TabIndex = 19
Top = 3225
Width = 6510
End
Begin VB.Label Label9
Caption = "預定收支情況,以后程序能按所填的時間間隔自動將收支情況加入數據庫."
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 255
Left = 105
TabIndex = 18
Top = 105
Width = 6675
End
Begin VB.Label Label8
Caption = "備注"
Height = 300
Left = 360
TabIndex = 15
Top = 1650
Width = 615
End
Begin VB.Label Label7
Caption = "時間"
Height = 240
Left = 4050
TabIndex = 12
Top = 3915
Width = 825
End
Begin VB.Label Label6
Caption = "金額"
Height = 255
Left = 120
TabIndex = 11
Top = 3945
Width = 870
End
Begin VB.Label Label4
Caption = "開始日期"
Height = 240
Left = 3375
TabIndex = 7
Top = 540
Width = 855
End
Begin VB.Label Label3
Caption = "時間間隔"
Height = 195
Left = 210
TabIndex = 6
Top = 1125
Width = 735
End
Begin VB.Label Label2
Caption = "金額類別"
Height = 195
Left = 3360
TabIndex = 5
Top = 1125
Width = 1035
End
Begin VB.Label Label1
Caption = "預定金額"
Height = 330
Left = 225
TabIndex = 4
Top = 540
Width = 735
End
End
Attribute VB_Name = "Frmadd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim ggzb As Database
Dim ggyzj As Recordset
Private Sub Comexit_Click()
Unload Me
End Sub
Private Sub Command1_Click()
Textmon.Locked = False
Textdate.Locked = False
Text2.Locked = False
每月.Enabled = True
工資收入.Enabled = True
Data1.Recordset.AddNew
Data1.Recordset.Update
Data1.Recordset.MoveLast
End Sub
Private Sub Command2_Click()
If Data1.Recordset.RecordCount = 0 Then
MsgBox "沒有記錄,不能刪除。", 48, "你想干嘛"
Exit Sub
End If
If Data1.Recordset.RecordCount = 1 Then
Data1.Recordset.Delete
Unload Me
Exit Sub
End If
Data1.Recordset.Delete
Data1.Refresh
End Sub
Private Sub Command3_Click()
Dim ko As Byte
ggyzj.MoveFirst
ggyzj.Move Combo1.ListIndex
ggyzj.Edit
ko = MsgBox("您要把" + Format(ggyzj.Fields(0), "yy-mm") + "的上月余額" + Trim(Str(ggyzj.Fields(1))) + "更改為元" + Text1.Text + "元嗎?", 36, "確認")
If ko = vbYes Then
ggyzj.Fields(1) = Val(Text1.Text)
ggyzj.Update
Else
ggyzj.CancelUpdate
End If
End Sub
Private Sub Form_Activate()
If Data1.Recordset.RecordCount = 0 Then
Textmon.Locked = True
Textdate.Locked = True
Text2.Locked = True
每月.Enabled = False
工資收入.Enabled = False
End If
End Sub
Private Sub Form_Load()
Set ggzb = OpenDatabase(App.Path + "\zb.mdb")
Set ggyzj = ggzb.OpenRecordset("yzj", dbOpenDynaset)
Do While ggyzj.AbsolutePosition <> -1
Combo1.AddItem (Format(ggyzj.Fields(0), "yy-mm"))
ggyzj.MoveNext
Loop
Combo1.ListIndex = 0
Data1.DatabaseName = App.Path + "\zb.mdb"
工資收入.AddItem "工資收入"
工資收入.AddItem "獎金收入"
工資收入.AddItem "福利收入"
工資收入.AddItem "打工收入"
工資收入.AddItem "其它收入"
工資收入.AddItem "生活支出"
工資收入.AddItem "學習支出"
工資收入.AddItem "娛樂支出"
工資收入.AddItem "投資支出"
工資收入.AddItem "其它支出"
工資收入.Text = "工資收入"
每月.AddItem "每年"
每月.AddItem "每季"
每月.AddItem "每月"
每月.AddItem "每周"
每月.AddItem "每天"
每月.Text = "每月"
End Sub
Private Sub Form_Unload(Cancel As Integer)
ggzb.Close
End Sub
Private Sub Text1_LostFocus()
If Not IsNumeric(Text1.Text) Then
With Text1
.SelStart = 0
.SelLength = Len(Text1.Text)
.SetFocus
End With
MsgBox "您要填寫數字", 48, "提醒"
End If
End Sub
Private Sub 工資收入_LostFocus()
Select Case 工資收入.Text
Case "工資收入"
Case "獎金收入"
Case "福利收入"
Case "打工收入"
Case "其它收入"
Case "生活支出"
Case "娛樂支出"
Case "學習支出"
Case "投資支出"
Case "其它支出"
Case Else
MsgBox "您輸入的收支類別不合程序要求,這可能會造成計算的不正確!" + Chr(13) + "請點擊右邊的下拉箭頭,并從中選擇一個類別!", 48, "類別錯誤"
工資收入.SelStart = 0
工資收入.SelLength = Len(工資收入.Text)
工資收入.SetFocus
End Select
End Sub
Private Sub 每月_LostFocus()
Select Case 每月.Text
Case "每年"
Case "每季"
Case "每月"
Case "每周"
Case "每天"
Case Else
MsgBox "您輸入的間隔不合程序要求,這可能會造成計算的不正確!程序默認是每月." + Chr(13) + "請點擊右邊的下拉箭頭,并從中選擇一個!", 48, "類別錯誤"
End Select
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -