📄 frmedlev1.frm
字号:
VERSION 5.00
Begin VB.Form frmEdlev1
Caption = "记录编辑"
ClientHeight = 3300
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3300
ScaleWidth = 4680
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton Comm2
Caption = "取消"
Height = 495
Left = 2640
TabIndex = 10
Top = 2640
Width = 855
End
Begin VB.CommandButton Comm1
Caption = "确定"
Height = 495
Left = 1080
TabIndex = 9
Top = 2640
Width = 855
End
Begin VB.Frame Frame1
Caption = "记录编辑"
Height = 2415
Left = 480
TabIndex = 0
Top = 120
Width = 3735
Begin VB.TextBox Text1
Height = 405
Index = 3
Left = 1200
TabIndex = 8
Top = 1920
Width = 1815
End
Begin VB.TextBox Text1
Height = 405
Index = 2
Left = 1200
TabIndex = 7
Top = 1440
Width = 1815
End
Begin VB.TextBox Text1
Height = 405
Index = 1
Left = 1200
TabIndex = 6
Top = 840
Width = 1815
End
Begin VB.TextBox Text1
Height = 405
Index = 0
Left = 1200
TabIndex = 5
Top = 360
Width = 1815
End
Begin VB.Label Label1
Caption = "借书天数"
Height = 375
Index = 3
Left = 240
TabIndex = 4
Top = 1920
Width = 735
End
Begin VB.Label Label1
Caption = "借书总数"
Height = 375
Index = 2
Left = 240
TabIndex = 3
Top = 1440
Width = 735
End
Begin VB.Label Label1
Caption = "过期罚款"
Height = 375
Index = 1
Left = 240
TabIndex = 2
Top = 840
Width = 735
End
Begin VB.Label Label1
Caption = "级 别"
Height = 375
Index = 0
Left = 240
TabIndex = 1
Top = 360
Width = 735
End
End
End
Attribute VB_Name = "frmEdlev1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cond As String
Private Sub Comm1_Click() '确定
Dim n As Integer
If Trim(Text1(0).Text) = "" Or Trim(Text1(1).Text) = "" _
Or Trim(Text1(2).Text) = "" Or Trim(Text1(3).Text) = "" Then
MsgBox "数据项不全,请重新设置", vbOKOnly, "信息提示"
Text1(0).SetFocus
Exit Sub
End If
If flag = 1 Then '添加操作
If frmEdlev.Adodc1.Recordset.RecordCount > 0 Then '原记录个数大于0
cond = "级别='" + Trim(Text1(0).Text) + "'"
frmEdlev.Adodc1.Recordset.MoveFirst '每次从头找起
frmEdlev.Adodc1.Recordset.Find (cond)
If Not frmEdlev.Adodc1.Recordset.EOF() Then
MsgBox "存在完全相同的记录", vbOKOnly, "信息提示"
Text1(0).SetFocus
Exit Sub
End If
End If
frmEdlev.Adodc1.Recordset.AddNew
frmEdlev.Adodc1.Recordset.Fields("级别") = Trim(Text1(0).Text)
frmEdlev.Adodc1.Recordset.Fields("过期罚款") = Val(Trim(Text1(1).Text))
frmEdlev.Adodc1.Recordset.Fields("借书总数") = Val(Trim(Text1(2).Text))
frmEdlev.Adodc1.Recordset.Fields("借书天数") = Val(Trim(Text1(3).Text))
frmEdlev.Adodc1.Recordset.Update
recs = recs + 1
Else '修改操作
n = frmEdlev.Adodc1.Recordset.AbsolutePosition
cond = "级别='" + Trim(Text1(0).Text) + "'"
frmEdlev.Adodc1.Recordset.MoveFirst '每次从头找起
frmEdlev.Adodc1.Recordset.Find (cond)
If Not frmEdlev.Adodc1.Recordset.EOF() And _
frmEdlev.Adodc1.Recordset.AbsolutePosition <> n Then
MsgBox "存在完全相同的记录", vbOKOnly, "信息提示"
frmEdlev.Adodc1.Recordset.MoveFirst '这两句恢复原记录位置
frmEdlev.Adodc1.Recordset.Move (n - 1)
Text1(0).SetFocus
Exit Sub
End If
frmEdlev.Adodc1.Recordset.MoveFirst '这两句恢复原记录位置
frmEdlev.Adodc1.Recordset.Move (n - 1)
frmEdlev.Adodc1.Recordset.Fields("级别") = Trim(Text1(0).Text)
frmEdlev.Adodc1.Recordset.Fields("过期罚款") = Val(Trim(Text1(1).Text))
frmEdlev.Adodc1.Recordset.Fields("借书天数") = Val(Trim(Text1(3).Text))
frmEdlev.Adodc1.Recordset.Update
End If
Unload Me
End Sub
Private Sub Comm2_Click()
Unload Me
End Sub
Private Sub Form_Load()
If flag = 2 Then
Text1(0).Text = frmEdlev.Adodc1.Recordset.Fields("级别")
Text1(1).Text = frmEdlev.Adodc1.Recordset.Fields("过期罚款")
Text1(2).Text = frmEdlev.Adodc1.Recordset.Fields("借书总数")
Text1(3).Text = frmEdlev.Adodc1.Recordset.Fields("借书天数")
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -