📄 form4.frm
字号:
Appearance = 0 'Flat
BackColor = &H80000005&
BackStyle = 0 'Transparent
Caption = "男"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 375
Left = 4100
TabIndex = 9
Top = 1650
Width = 855
End
Begin VB.Label Label2
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
BackStyle = 0 'Transparent
Caption = "Label1"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 375
Left = 3960
TabIndex = 8
Top = 1073
Width = 1695
End
Begin VB.Label Label1
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
BackStyle = 0 'Transparent
Caption = "Label1"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 375
Left = 1440
TabIndex = 7
Top = 1073
Width = 1695
End
End
Attribute VB_Name = "form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Combo4_Change()
If KeyAscii = 13 Then
If Combo4.Text = "否" Then
Combo4.Text = "是"
Exit Sub
Else
Combo4.Text = "否"
End If
Else
Exit Sub
End If
End Sub
Private Sub Command1_Click()
Call xpbutton1_Click
End Sub
Private Sub Form_Load()
Me.BackColor = RGB(121, 153, 207)
Dim data1 As String
DTPicker2.Value = Date + 1460
utid2
End Sub
Private Sub Image1_Click()
Unload Me
End Sub
Private Sub Timer1_Timer()
End Sub
Private Sub xpbutton1_Click()
If admin = False Then '检测是否具有管理员权限
MsgBox "非管理员不可操作,谢谢合作", vbInformation, "错误操作"
Exit Sub
End If
If Text1.Visible = False Then
Exit Sub
End If
If qy1.State = adStateOpen Then '检测数据库是否打开状态
qy1.Close
End If
If Text1.Text = "" And Text2.Text = "" Then
MsgBox "编号和姓名不可为空,请检查看输入", vbInformation, "输入错误"
Exit Sub
End If
qy1.Open "select * from 个人信息", cnn, adOpenKeyset, adLockOptimistic, adCmdText
Do While qy1.EOF = False
If qy1.Fields(0) = Text1.Text Then
MsgBox "您输入的编号己存在!", vbInformation, "编号重复"
Text1.Text = ""
Exit Sub
Else
qy1.MoveNext
End If
Loop
qy1.AddNew
qy1.Fields(0) = Text1.Text + t
qy1.Fields(1) = Text2.Text
qy1.Fields(2) = Text4.Text
qy1.Fields(3) = Combo2.Text
qy1.Fields(4) = DTPicker1.Value
qy1.Fields(5) = Combo1.Text
qy1.Fields(6) = Text3.Text
qy1.Fields(7) = DTPicker2.Value
qy1.Fields(8) = Combo3.Text
qy1.Fields(9) = "0"
qy1.Fields(10) = "否"
qy1.Update
MsgBox "数据己添加成功", vbInformation, "添加成功"
End Sub
Private Sub xpbutton2_Click()
If admin = False Then
MsgBox "非管理员不可操作,谢谢合作", vbInformation, "错误操作"
Exit Sub
End If
If Text1.Visible = False Then
Exit Sub
End If
If qy1.State = adStateOpen Then
qy1.Close
End If
qy1.Open "select * from 个人信息", cnn, adOpenKeyset, adLockOptimistic, adCmdText
Do While qy1.EOF = False
If qy1.Fields(0) = Text1.Text Then
qy1.Delete
qy1.Update
MsgBox "数据己删除", vbInformation, "删除用户"
Unload Me
Else
qy1.MoveNext
End If
Loop
End Sub
Private Sub xpbutton3_Click()
If admin = False Then
MsgBox "非管理员不可使用"
Exit Sub
End If
If Text1.Visible = False Then
Exit Sub
End If
If qy1.State = adStateOpen Then
qy1.Close
End If
qy1.Open "select * from 个人信息 where 学号='" & Text1.Text & "'", cnn, adOpenKeyset, adLockOptimistic, adCmdText
Text1.Text = qy1.Fields(0)
Text2.Text = qy1.Fields(1)
Combo2.Text = qy1.Fields(3)
DTPicker1.Value = qy1.Fields(4)
Combo1.Text = qy1.Fields(5)
Text3.Text = qy1.Fields(6)
DTPicker2.Value = qy1.Fields(7)
Combo3.Text = qy1.Fields(8)
Label9.Visible = True
Label9.Caption = qy1.Fields(9)
Combo4.Text = qy1.Fields(10)
End Sub
Private Sub xpbutton4_Click()
If admin = False Then
MsgBox "非管理员不可操作,谢谢合作", vbInformation, "错误操作"
Exit Sub
End If
If Text1.Visible = False Then
Exit Sub
End If
If qy1.State = adStateOpen Then
qy1.Close
End If
If Text1.Text = "" And Text2.Text = "" Then
MsgBox "编号和姓名不可为空,请检查看输入", vbInformation, "输入错误"
Exit Sub
End If
qy1.Open "select * from 个人信息", cnn, adOpenKeyset, adLockOptimistic, adCmdText
Do While qy1.EOF = False
If qy1.Fields(0) = Text1.Text Then
qy1.Fields(1) = Text2.Text '姓名
qy1.Fields(2) = Text4.Text '密码
qy1.Fields(3) = Combo2.Text '性别
qy1.Fields(4) = DTPicker1.Value '出生日期
qy1.Fields(5) = Combo1.Text '职业
qy1.Fields(6) = Text3.Text '单位
qy1.Fields(7) = DTPicker2.Value '借书证到期时间
qy1.Fields(8) = Combo3.Text '是否特殊用户
qy1.Fields(10) = Combo4.Text '是否为管理员
qy1.Update
MsgBox "数据己修改成功", vbInformation, "修改成功"
Exit Sub
Else
qy1.MoveNext
End If
Loop
End Sub
Private Sub vt1() '设定添加系统所有控件隐藏
Text1.Visible = False
Text2.Visible = False
Text3.Visible = False
Text4.Visible = False
Combo1.Visible = False
Combo2.Visible = False
Combo3.Visible = False
Combo4.Visible = False
DTPicker1.Visible = False
DTPicker2.Visible = False
End Sub
Private Sub vt3() '设定添加系统所有控件显示
Text1.Visible = True
Text2.Visible = True
Text3.Visible = True
Text4.Visible = True
Combo1.Visible = True
Combo2.Visible = True
Combo3.Visible = True
Combo4.Visible = True
DTPicker1.Visible = True
DTPicker2.Visible = True
End Sub
Private Sub vt2() '设定显示个人信息所有控件隐藏
Label1.Visible = False
Label2.Visible = False
Label3.Visible = False
Label4.Visible = False
Label5.Visible = False
Label6.Visible = False
Label7.Visible = False
Label8.Visible = False
Label10.Visible = False
End Sub
Private Sub vt4() '设定显示个人信息所有控件显示
Label1.Visible = True
Label2.Visible = True
Label3.Visible = True
Label4.Visible = True
Label5.Visible = True
Label6.Visible = True
Label7.Visible = True
Label8.Visible = True
Label10.Visible = True
End Sub
Private Sub Timer2_Timer()
If ifuser = "4" Then
vt1
If qy1.State = adStateOpen Then
qy1.Close
End If
qy1.Open "select * from 个人信息", cnn, adOpenKeyset, adLockOptimistic, adCmdText
Do While qy1.EOF = False
If qy1.Fields(0) = id Then '去除密码项,增加保密
Label1.Caption = qy1.Fields(0)
Label2.Caption = qy1.Fields(1)
Label3.Caption = qy1.Fields(3)
Label4.Caption = Str(qy1.Fields(4))
Label5.Caption = qy1.Fields(5)
Label6.Caption = qy1.Fields(6)
Label7.Caption = Str(qy1.Fields(7))
Label8.Caption = qy1.Fields(8)
Label9.Caption = qy1.Fields(9)
Label10.Caption = qy1.Fields(10)
vt4
Exit Sub
Else
qy1.MoveNext
End If
Loop
Exit Sub
End If
If ifuser = "6" Then
vt2
vt3
Exit Sub
End If
Timer2.Interval = 0
End Sub
Private Sub utid2()
If ifuser = "5" Then
If qy1.State = adStateOpen Then
qy1.Close
End If
qy1.Open "select * from 个人信息 where 学号='" & tkUserID & "'", cnn, adOpenKeyset, adLockOptimistic, adCmdText
Text1.Text = qy1.Fields(0)
Text2.Text = qy1.Fields(1)
Combo2.Text = qy1.Fields(3)
DTPicker1.Value = qy1.Fields(4)
Combo1.Text = qy1.Fields(5)
Text3.Text = qy1.Fields(6)
DTPicker2.Value = qy1.Fields(7)
Combo3.Text = qy1.Fields(8)
Label9.Visible = True
Label9.Caption = qy1.Fields(9)
Combo4.Text = qy1.Fields(10)
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -