📄 frmruaddnew.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomct2.ocx"
Begin VB.Form frmruaddnew
BorderStyle = 1 'Fixed Single
Caption = "新增收入"
ClientHeight = 3015
ClientLeft = 4965
ClientTop = 3975
ClientWidth = 5280
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3015
ScaleWidth = 5280
Begin VB.CommandButton cmdexit
Caption = "退出"
Height = 495
Left = 3840
TabIndex = 12
Top = 2280
Width = 1215
End
Begin VB.CommandButton cmdcancel
Caption = "取消"
Height = 495
Left = 1920
TabIndex = 11
Top = 2280
Width = 1215
End
Begin VB.CommandButton cmdok
Caption = "确定"
Height = 495
Left = 120
TabIndex = 10
Top = 2280
Width = 1215
End
Begin VB.TextBox txt_money
Height = 300
Left = 1080
TabIndex = 9
Top = 1680
Width = 1250
End
Begin VB.ComboBox cbo_kind
Height = 300
ItemData = "frmruaddnew.frx":0000
Left = 3600
List = "frmruaddnew.frx":0019
TabIndex = 8
Top = 840
Width = 1250
End
Begin MSComCtl2.DTPicker dpkru_day
Height = 300
Left = 1080
TabIndex = 7
Top = 840
Width = 1250
_ExtentX = 2196
_ExtentY = 529
_Version = 393216
Format = 82182145
CurrentDate = 38429
End
Begin VB.ComboBox cbo_man
Height = 300
ItemData = "frmruaddnew.frx":005F
Left = 3600
List = "frmruaddnew.frx":0069
TabIndex = 6
Top = 120
Width = 1250
End
Begin VB.TextBox txt_order
Height = 300
Left = 1080
TabIndex = 5
Top = 120
Width = 1250
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "收入金额:"
Height = 180
Left = 120
TabIndex = 4
Top = 1800
Width = 900
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "收入类别:"
Height = 180
Left = 2640
TabIndex = 3
Top = 960
Width = 900
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "收入人:"
Height = 180
Left = 2640
TabIndex = 2
Top = 240
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "收入日期:"
Height = 180
Left = 120
TabIndex = 1
Top = 960
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "收入编号:"
Height = 180
Left = 120
TabIndex = 0
Top = 240
Width = 900
End
End
Attribute VB_Name = "frmruaddnew"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rudb As Database
Dim rurst As Recordset
Private Sub cmdcancel_Click()
txt_order.Text = (rurst.RecordCount) + 1
cbo_man.Text = ""
cbo_kind.Text = ""
txt_money.Text = ""
dpkru_day.Value = Date
End Sub
Private Sub cmdexit_Click()
Unload Me
frmmain.Show
End Sub
Private Sub cmdok_Click()
'判断各输入框的内容是否为空
If cbo_man.Text = "" Then
MsgBox "收入人不能为空,请选择!", vbOKOnly + vbExclamation, "警告"
cbo_man.SetFocus
Exit Sub
End If
If cbo_kind.Text = "" Then
MsgBox "收入种类不能为空,请选择!", vbOKOnly + vbExclamation, "警告"
cbo_kind.SetFocus
Exit Sub
End If
If dpkru_day.Value = "" Then
MsgBox "收入日期不能为空,请选择!", vbOKOnly + vbExclamation, "警告"
dpkru_day.SetFocus
Exit Sub
End If
If txt_money.Text = "" Then
MsgBox "收入金额不能为空,请选择!", vbOKOnly + vbExclamation, "警告"
txt_money.SetFocus
Exit Sub
End If
'添加新记录
With rurst
.addnew
!ru_order = Trim$(txt_order.Text)
!ru_man = Trim$(cbo_man.Text)
!ru_date = dpkru_day.Value
!ru_kind = Trim$(cbo_kind.Text)
!ru_number = Trim$(txt_money.Text)
.Update
End With
txt_order.Text = (rurst.RecordCount) + 1
cbo_man.ListIndex = 1
txt_money.Text = ""
End Sub
Private Sub Form_Load()
Set rudb = OpenDatabase(App.Path & "\payout.mdb")
Set rurst = rudb.OpenRecordset("rumoney")
If rurst.RecordCount <= 0 Then
MsgBox "收入数据表中还没有数据,请添加!", vbOKOnly + vbInformation, "无数据"
txt_order.Text = 1
cbo_man.ListIndex = 0
cbo_kind.ListIndex = 0
dpkru_day.Value = Date
Exit Sub
Else
txt_order.Text = (rurst.RecordCount) + 1
cbo_man.ListIndex = 0
cbo_kind.ListIndex = 0
dpkru_day.Value = Date
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Unload Me
frmmain.Show
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -