📄 operate.frm
字号:
VERSION 5.00
Begin VB.Form form2
BorderStyle = 1 'Fixed Single
Caption = "编辑学生信息"
ClientHeight = 3300
ClientLeft = 150
ClientTop = 435
ClientWidth = 4455
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3300
ScaleWidth = 4455
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton Command5
Caption = "退 出"
BeginProperty Font
Name = "Times New Roman"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3240
TabIndex = 9
Top = 2760
Width = 1095
End
Begin VB.CommandButton Command3
Caption = "删 除"
BeginProperty Font
Name = "Times New Roman"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3240
TabIndex = 8
Top = 2160
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "修 改"
BeginProperty Font
Name = "Times New Roman"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3240
TabIndex = 7
Top = 1560
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "添 加"
BeginProperty Font
Name = "Times New Roman"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3240
TabIndex = 6
Top = 960
Width = 1095
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "D:\My Documents\ZQH\VB\mis\mis.mdb"
DefaultCursorType= 0 'DefaultCursor
DefaultType = 2 'UseODBC
Exclusive = 0 'False
BeginProperty Font
Name = "Times New Roman"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 345
Left = 240
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "STUDENT"
Top = 2880
Width = 2655
End
Begin VB.Frame Frame1
Caption = "学生情况"
BeginProperty Font
Name = "Times New Roman"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2655
Left = 120
TabIndex = 0
Top = 120
Width = 3015
Begin VB.TextBox Text5
DataField = "借阅量"
DataSource = "Data1"
BeginProperty Font
Name = "Times New Roman"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1080
Locked = -1 'True
TabIndex = 5
Top = 2160
Width = 735
End
Begin VB.TextBox Text4
DataField = "专业"
DataSource = "Data1"
BeginProperty Font
Name = "Times New Roman"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1080
Locked = -1 'True
TabIndex = 4
Top = 1680
Width = 1215
End
Begin VB.TextBox Text3
DataField = "班级"
DataSource = "Data1"
BeginProperty Font
Name = "Times New Roman"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1080
Locked = -1 'True
TabIndex = 3
Top = 1200
Width = 1215
End
Begin VB.TextBox Text2
DataField = "姓名"
DataSource = "Data1"
BeginProperty Font
Name = "Times New Roman"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1080
Locked = -1 'True
TabIndex = 2
Top = 720
Width = 1575
End
Begin VB.TextBox Text1
DataField = "学号"
DataSource = "Data1"
BeginProperty Font
Name = "Times New Roman"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1080
Locked = -1 'True
TabIndex = 1
Top = 240
Width = 1815
End
Begin VB.Label Label2
Caption = "借阅量"
BeginProperty Font
Name = "Times New Roman"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 4
Left = 240
TabIndex = 14
Top = 2280
Width = 855
End
Begin VB.Label Label2
Caption = "专业"
BeginProperty Font
Name = "Times New Roman"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 3
Left = 240
TabIndex = 13
Top = 1800
Width = 855
End
Begin VB.Label Label2
Caption = "班级"
BeginProperty Font
Name = "Times New Roman"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 2
Left = 240
TabIndex = 12
Top = 1320
Width = 855
End
Begin VB.Label Label2
Caption = "姓名"
BeginProperty Font
Name = "Times New Roman"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 1
Left = 240
TabIndex = 11
Top = 840
Width = 855
End
Begin VB.Label Label2
Caption = "学号"
BeginProperty Font
Name = "Times New Roman"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 0
Left = 240
TabIndex = 10
Top = 360
Width = 615
End
End
End
Attribute VB_Name = "form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim DbStr As String
Private Sub Command1_Click() '进入添加STUDENT或BOOK数据表记录的界面,或进入借书界面
flag2 = True '执行添加动作
If flag3 = True Then
Form3.Show 1
End If
If flag4 = True Then
Form4.Show 1
End If
End Sub
Private Sub Command2_Click() '进入修改STUDENT或BOOK数据表记录的界面,或进入还书界面
flag2 = False '执行修改动作
If flag3 = True Then
Form3.Text1.Locked = True '控件锁定,不能修改关键字,若要修改,则先删除此项记录再添加记录
Form3.Show 1
End If
If flag4 = True Then
Form4.Text1.Locked = True
Form4.Show 1
End If
End Sub
Private Sub Command3_Click() '删除记录
Dim i As Integer
Dim result As Integer
If Not Data1.Recordset.EOF Or Data1.Recordset.BOF Then
result = MsgBox("当前记录将被删除", 48 + vbOKCancel, "警告")
If result = vbOK Then
Data1.Recordset.Delete
Data1.Update
End If
Else
rusult = MsgBox("无法删除当前记录", 48, "提示")
End If
End Sub
Private Sub Command5_Click() '退出
Unload Me
End Sub
Private Sub Form_Load() '窗体装载
Data1.DatabaseName = App.Path + "\mis.mdb"
If flag3 = True Then
DbStr = "STUDENT" '引用学生数据表
Text1.DataField = "学号" '绑定数据字段
Text2.DataField = "姓名"
Text3.DataField = "班级"
Text4.DataField = "专业"
Text5.DataField = "借阅量"
Caption = "编辑学生信息" '编辑窗体界面
Frame1.Caption = "学生情况"
Label2(0).Caption = "学号"
Label2(1).Caption = "姓名"
Label2(2).Caption = "班级"
Label2(3).Caption = "专业"
Label2(4).Caption = "借阅量"
End If
If flag4 = True Then
DbStr = "BOOK" '引用图书数据表
Text1.DataField = "书号" '绑定数据字段
Text2.DataField = "书名"
Text3.DataField = "著者"
Text4.DataField = "出版社"
Text5.DataField = "标志"
Caption = "编辑图书信息" '编辑窗体
Frame1.Caption = "图书情况"
Label2(0).Caption = "书号"
Label2(1).Caption = "书名"
Label2(2).Caption = "著者"
Label2(3).Caption = "出版社"
Label2(4).Caption = "标志"
Text4.Width = form2.Text2.Width
Text2.Width = form2.Text1.Width
Text3.Width = form2.Text4.Width
End If
If flag5 = True Then
DbStr = "STUDBR" '引用借还书数据表
Text1.DataField = "书号" '绑定数据字段
Text2.DataField = "学号"
Text3.DataField = "书名"
Text4.DataField = "借阅日期"
Text5.DataField = "应还日期"
Caption = "编辑借还书档案" '编辑窗体
Frame1.Caption = "借还书情况"
Label2(0).Caption = "书号"
Label2(1).Caption = "学号"
Label2(2).Caption = "书名"
Label2(3).Caption = "借阅日期"
Label2(4).Caption = "应还日期"
Text3.Width = form2.Text2.Width
Text1.Width = form2.Text2.Width
Text5.Width = form2.Text4.Width
Command1.Visible = False
Command2.Visible = False
End If
Data1.RecordSource = DbStr
'更新数据库
Data1.Refresh
Data1.Caption = DbStr
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -