📄 frmaccrual.frm
字号:
VERSION 5.00
Begin VB.Form frmAccrual
BackColor = &H00404040&
BorderStyle = 1 'Fixed Single
Caption = "利率"
ClientHeight = 3330
ClientLeft = 45
ClientTop = 435
ClientWidth = 5820
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 3330
ScaleWidth = 5820
Begin VB.CommandButton cmdClose
Cancel = -1 'True
Caption = "关 闭"
Height = 345
Left = 4560
TabIndex = 9
Top = 1440
Width = 975
End
Begin VB.CommandButton cmdUpdate
Caption = "修 改"
Height = 345
Left = 4560
TabIndex = 8
Top = 840
Width = 975
End
Begin VB.CommandButton cmdSave
Caption = "保 存"
Default = -1 'True
Enabled = 0 'False
Height = 345
Left = 4560
TabIndex = 7
Top = 240
Width = 975
End
Begin VB.TextBox txt
Enabled = 0 'False
Height = 270
Index = 8
Left = 1200
TabIndex = 6
Top = 2760
Width = 2175
End
Begin VB.TextBox txt
Enabled = 0 'False
Height = 270
Index = 5
Left = 1200
TabIndex = 5
Top = 2280
Width = 2175
End
Begin VB.TextBox txt
Enabled = 0 'False
Height = 270
Index = 3
Left = 1200
TabIndex = 4
Top = 1800
Width = 2175
End
Begin VB.TextBox txt
Enabled = 0 'False
Height = 270
Index = 2
Left = 1200
TabIndex = 3
Top = 1320
Width = 2175
End
Begin VB.TextBox txt
Enabled = 0 'False
Height = 270
Index = 1
Left = 1200
TabIndex = 2
Top = 840
Width = 2175
End
Begin VB.TextBox txt
Enabled = 0 'False
Height = 270
Index = 0
Left = 1200
TabIndex = 1
Top = 360
Width = 2175
End
Begin VB.Line line
BorderColor = &H00FFFFFF&
BorderWidth = 2
X1 = 4200
X2 = 4200
Y1 = 0
Y2 = 3360
End
Begin VB.Label lbl
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "八年:"
ForeColor = &H00FFFFFF&
Height = 180
Index = 1
Left = 600
TabIndex = 14
Top = 2880
Width = 540
End
Begin VB.Label lbl
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "三年:"
ForeColor = &H00FFFFFF&
Height = 180
Index = 5
Left = 600
TabIndex = 13
Top = 1920
Width = 540
End
Begin VB.Label lbl
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "五年:"
ForeColor = &H00FFFFFF&
Height = 180
Index = 4
Left = 600
TabIndex = 12
Top = 2400
Width = 540
End
Begin VB.Label lbl
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "一年:"
ForeColor = &H00FFFFFF&
Height = 180
Index = 3
Left = 600
TabIndex = 11
Top = 960
Width = 540
End
Begin VB.Label lbl
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "二年:"
ForeColor = &H00FFFFFF&
Height = 180
Index = 2
Left = 600
TabIndex = 10
Top = 1440
Width = 540
End
Begin VB.Label lbl
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "活期:"
ForeColor = &H00FFFFFF&
Height = 180
Index = 0
Left = 600
TabIndex = 0
Top = 480
Width = 540
End
End
Attribute VB_Name = "frmAccrual"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'响应 "关闭" 按钮
Private Sub cmdClose_Click()
Unload Me
End Sub
'响应 "保存" 按钮
Private Sub cmdSave_Click()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'判断用户的输入是否为数字↓
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim theAccrual As Double
Dim accrualDouble As Boolean
accrualDouble = False
On Error GoTo err1
For i = 0 To 3
theAccrual = CDbl(txt(i).Text)
Next i
theAccrual = CDbl(txt(5).Text)
theAccrual = CDbl(txt(8).Text)
accrualDouble = True
err1:
If Not accrualDouble Then
MsgBox "请确定你所输入的是数字!"
Exit Sub
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'判断利率表是否正确↓
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim rst As New Recordset
Call LinkDB(landWay, SName, "weboy", SUName, SUPw) '此语句用于连接数据库,具体可以到 shareFunction 模块中找到说明
con.Open
Dim errGet As Boolean
errGet = True
On Error GoTo errGoto
rst.Open "select * from accrual", con, adOpenDynamic, adLockOptimistic
rst.MoveFirst
rst.Close
errGet = False
errGoto:
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If errGet Then '如果利率表有问题,则直接插入数据
con.Execute "insert accrual values('0','" & CDbl(txt(0).Text) & "')"
con.Execute "insert accrual values('1','" & CDbl(txt(1).Text) & "')"
con.Execute "insert accrual values('2','" & CDbl(txt(2).Text) & "')"
con.Execute "insert accrual values('3','" & CDbl(txt(3).Text) & "')"
con.Execute "insert accrual values('5','" & CDbl(txt(5).Text) & "')"
con.Execute "insert accrual values('8','" & CDbl(txt(8).Text) & "')"
Else '如果利率表没有问题,则更新利率表
con.Execute "update accrual set percentage=" & CDbl(txt(0).Text) & " where theYear='0'"
con.Execute "update accrual set percentage=" & CDbl(txt(1).Text) & " where theYear='1'"
con.Execute "update accrual set percentage=" & CDbl(txt(2).Text) & " where theYear='2'"
con.Execute "update accrual set percentage=" & CDbl(txt(3).Text) & " where theYear='3'"
con.Execute "update accrual set percentage=" & CDbl(txt(5).Text) & " where theYear='5'"
con.Execute "update accrual set percentage=" & CDbl(txt(8).Text) & " where theYear='8'"
End If
con.Close
'''''''''''''''''''''''''''''''''''''''' 给利率变量赋值↓
percentage0 = CDbl(txt(0).Text)
percentage1 = CDbl(txt(1).Text)
percentage2 = CDbl(txt(2).Text)
percentage3 = CDbl(txt(3).Text)
percentage5 = CDbl(txt(5).Text)
percentage8 = CDbl(txt(8).Text)
''''''''''''''''''''''''''''''''''''''''
MsgBox "保存成功!"
Unload Me
Me.Show
End Sub
'响应 "修改" 按钮
Private Sub cmdUpdate_Click()
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'激活控件↓
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
For i = 0 To 3
txt(i).Enabled = True
Next i
txt(5).Enabled = True
txt(8).Enabled = True
cmdSave.Enabled = True
End Sub
Private Sub Form_Load() '将全部利息数据赋给相应的文本框
txt(0).Text = percentage0
txt(1).Text = percentage1
txt(2).Text = percentage2
txt(3).Text = percentage3
txt(5).Text = percentage5
txt(8).Text = percentage8
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -