📄 addstudent.frm
字号:
VERSION 5.00
Begin VB.Form addstudent
Caption = "增加读者"
ClientHeight = 3495
ClientLeft = 60
ClientTop = 345
ClientWidth = 5775
ForeColor = &H00C00000&
LinkTopic = "Form1"
Moveable = 0 'False
ScaleHeight = 3495
ScaleWidth = 5775
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
Height = 3255
Left = 120
TabIndex = 0
Top = 120
Width = 5535
Begin VB.TextBox Text4
Height = 375
IMEMode = 3 'DISABLE
Left = 3960
PasswordChar = "*"
TabIndex = 16
Top = 360
Width = 1215
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "db2.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 345
Left = 2160
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "student"
Top = 1800
Visible = 0 'False
Width = 1380
End
Begin VB.TextBox Text6
Height = 270
Left = 3960
TabIndex = 14
Top = 1080
Width = 1215
End
Begin VB.CommandButton Command3
Caption = "退 出"
Height = 375
Left = 3840
TabIndex = 12
Top = 2280
Width = 735
End
Begin VB.CommandButton Command2
Caption = "取 消"
Height = 375
Left = 2400
TabIndex = 11
Top = 2280
Width = 735
End
Begin VB.CommandButton Command1
Caption = "确 定"
Height = 375
Left = 720
TabIndex = 10
Top = 2280
Width = 735
End
Begin VB.OptionButton Option2
Caption = "女"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 255
Left = 4560
TabIndex = 9
Top = 1560
Width = 735
End
Begin VB.OptionButton Option1
Caption = "男"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 255
Left = 3840
TabIndex = 8
Top = 1560
Width = 615
End
Begin VB.TextBox Text3
Height = 270
Left = 1080
TabIndex = 7
Top = 1080
Width = 1215
End
Begin VB.TextBox Text2
Height = 270
Left = 1080
TabIndex = 6
Top = 1560
Width = 1215
End
Begin VB.TextBox Text1
Height = 270
Left = 1080
TabIndex = 5
Top = 480
Width = 1215
End
Begin VB.Label Label2
Caption = "密 码:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 375
Left = 3000
TabIndex = 15
Top = 360
Width = 975
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "专 业:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 210
Index = 6
Left = 3000
TabIndex = 13
Top = 1080
Width = 705
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = " 性 别:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 210
Index = 3
Left = 2880
TabIndex = 4
Top = 1560
Width = 825
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = " 姓 名:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 210
Index = 2
Left = 240
TabIndex = 3
Top = 1560
Width = 825
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = " 班 级:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 210
Index = 1
Left = 240
TabIndex = 2
Top = 1080
Width = 825
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "卡 号:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 210
Index = 0
Left = 360
TabIndex = 1
Top = 480
Width = 585
End
End
End
Attribute VB_Name = "addstudent"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
condition = "卡号='" & Text1.Text & "'"
Data1.Recordset.MoveFirst
Data1.Recordset.FindFirst condition
If Not Data1.Recordset.NoMatch Then
MsgBox "该卡号已经存在,请换卡号!"
Exit Sub
Text1.SetFocus
End If
If Option1.Value = False And Option2.Value = False Then
MsgBox "你还没有选择性别呢,请选择!"
Exit Sub
End If
Data1.Recordset.AddNew
Data1.Recordset.Fields("卡号") = Text1.Text
Data1.Recordset.Fields("密码") = Text4.Text
Data1.Recordset.Fields("姓名") = Text2.Text
Data1.Recordset.Fields("班级") = Text3.Text
Data1.Recordset.Fields("专业") = Text6.Text
Data1.Recordset.Fields("挂失否") = "否"
Data1.Recordset.Fields("已借书数") = 0
If Option1.Value = True Then
Data1.Recordset.Fields("性别") = Option1.Caption
End If
If Option2.Value = True Then
Data1.Recordset.Fields("性别") = Option2.Caption
End If
Data1.Recordset.Update
MsgBox "增加成功!"
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text4.Text = ""
Text2.Text = ""
Text3.Text = ""
Text6.Text = ""
Option1.Value = False
Option2.Value = False
End Sub
Private Sub Command3_Click()
Unload addstudent
End Sub
Private Sub Image1_Click()
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -