📄 form4.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form Form4
BorderStyle = 1 'Fixed Single
Caption = "添加收支记录"
ClientHeight = 2520
ClientLeft = 45
ClientTop = 330
ClientWidth = 3795
Icon = "Form4.frx":0000
LinkTopic = "Form4"
LockControls = -1 'True
MaxButton = 0 'False
MDIChild = -1 'True
ScaleHeight = 2520
ScaleWidth = 3795
Begin MSAdodcLib.Adodc Adodc2
Height = 330
Left = 960
Top = 3720
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc2"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 720
Top = 4440
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Frame Frame1
Height = 1815
Left = 120
TabIndex = 7
Top = 0
Width = 3495
Begin VB.TextBox Text3
Appearance = 0 'Flat
Height = 735
Left = 2280
MaxLength = 100
MultiLine = -1 'True
TabIndex = 4
Top = 960
Width = 1095
End
Begin VB.OptionButton Option1
Caption = "添加支出记录"
Height = 255
Left = 120
TabIndex = 0
Top = 240
Value = -1 'True
Width = 1455
End
Begin VB.OptionButton Option2
Caption = "添加收入记录"
Height = 255
Left = 1920
TabIndex = 1
Top = 240
Width = 1455
End
Begin VB.TextBox Text2
Appearance = 0 'Flat
Height = 270
Left = 960
MaxLength = 10
TabIndex = 3
Top = 1440
Width = 1215
End
Begin VB.ComboBox Combo1
Height = 300
Left = 960
TabIndex = 2
Top = 660
Width = 1215
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 255
Left = 960
TabIndex = 12
Top = 1080
Width = 1215
_ExtentX = 2143
_ExtentY = 450
_Version = 393216
Format = 24510465
CurrentDate = 37978
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "收支时间"
Height = 180
Left = 120
TabIndex = 11
Top = 1125
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "收支金额"
Height = 180
Left = 120
TabIndex = 10
Top = 1485
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "收支类型"
Height = 180
Left = 120
TabIndex = 9
Top = 720
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "备 注"
Height = 180
Left = 2280
TabIndex = 8
Top = 720
Width = 540
End
End
Begin VB.CommandButton Command2
Cancel = -1 'True
Caption = "取消"
Height = 375
Left = 2280
TabIndex = 6
Top = 2040
Width = 975
End
Begin VB.CommandButton Command1
Caption = "添加"
Default = -1 'True
Height = 375
Left = 720
TabIndex = 5
Top = 2040
Width = 975
End
End
Attribute VB_Name = "Form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
If Not IsNumeric(Text2.Text) Then
MsgBox "收支金额必须为数字"
Exit Sub
End If
If Option1.Value Then
Adodc1.Recordset.Fields(1) = "支"
Else
Adodc1.Recordset.Fields(1) = "收"
End If
Adodc1.Recordset.Fields(0) = DTPicker1
Adodc1.Recordset.Fields(3) = Combo1.Text
Adodc1.Recordset.Update
Adodc1.Recordset.AddNew
MsgBox "添加成功!"
DTPicker1.Value = Date
Combo1.Text = Combo1.List(0)
Text2.Text = ""
Text3.Text = ""
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub DTPicker1_CloseUp()
If DTPicker1.Value > Date Then
MsgBox "您不能选择未来的日期!"
DTPicker1.Value = Date
Exit Sub
End If
End Sub
Private Sub Form_Load()
'限定可用日期
DTPicker1.Value = Date
DTPicker1.MaxDate = Date
DTPicker1.MinDate = Date - 365
Adodc1.ConnectionString = ado
Adodc1.RecordSource = "szb"
Adodc1.Refresh
Set Text2.DataSource = Adodc1
Adodc1.Refresh
Text2.DataField = "mn"
Set Text3.DataSource = Adodc1
Adodc1.Refresh
Text3.DataField = "bz"
'添加收入类型至组合框
Combo1.Clear
Adodc2.ConnectionString = ado
Adodc2.RecordSource = "zclx"
Adodc2.Refresh
While Not Adodc2.Recordset.EOF
Combo1.AddItem Adodc2.Recordset.Fields(0)
Adodc2.Recordset.MoveNext
Wend
Combo1.Text = Combo1.List(0)
Adodc1.Recordset.AddNew
End Sub
Private Sub Option1_Click()
'添加支出类型至组合框
Combo1.Clear
Adodc2.ConnectionString = ado
Adodc2.RecordSource = "zclx"
Adodc2.Refresh
While Not Adodc2.Recordset.EOF
Combo1.AddItem Adodc2.Recordset.Fields(0)
Adodc2.Recordset.MoveNext
Wend
DTPicker1.Value = Date
Combo1.Text = Combo1.List(0)
Text2.Text = ""
Text3.Text = ""
End Sub
Private Sub Option2_Click()
'添加收入类型至组合框
Combo1.Clear
Adodc2.ConnectionString = ado
Adodc2.RecordSource = "sylx"
Adodc2.Refresh
While Not Adodc2.Recordset.EOF
Combo1.AddItem Adodc2.Recordset.Fields(0)
Adodc2.Recordset.MoveNext
Wend
DTPicker1.Value = Date
Combo1.Text = Combo1.List(0)
Text2.Text = ""
Text3.Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -