📄
字号:
VERSION 5.00
Begin VB.Form 设置系统用户1
BorderStyle = 1 'Fixed Single
Caption = "编辑用户"
ClientHeight = 2700
ClientLeft = 45
ClientTop = 435
ClientWidth = 3270
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2700
ScaleWidth = 3270
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 2040
TabIndex = 8
Top = 2160
Width = 735
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 480
TabIndex = 7
Top = 2160
Width = 735
End
Begin VB.Frame Frame1
Caption = "用户编辑"
Height = 1935
Left = 120
TabIndex = 0
Top = 120
Width = 3015
Begin VB.ComboBox Combo1
Height = 300
Left = 1080
TabIndex = 6
Top = 1320
Width = 1695
End
Begin VB.TextBox Text2
Height = 270
Left = 1080
TabIndex = 5
Top = 840
Width = 1695
End
Begin VB.TextBox Text1
Height = 270
Left = 1080
TabIndex = 4
Top = 360
Width = 1695
End
Begin VB.Label Label3
Caption = "用户级别"
Height = 255
Left = 240
TabIndex = 3
Top = 1320
Width = 735
End
Begin VB.Label Label2
Caption = "口 令"
Height = 255
Left = 240
TabIndex = 2
Top = 840
Width = 735
End
Begin VB.Label Label1
Caption = "用 户 名"
Height = 255
Left = 240
TabIndex = 1
Top = 360
Width = 855
End
End
End
Attribute VB_Name = "设置系统用户1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim sqltxt1 As String
If Trim(Text1.Text) = "" Or Trim(Text2.Text) = "" Or Trim(Combo1.Text) = "" Then
MsgBox "数据项不全,请重新设置", vbOKOnly, "信息提示"
Text1.SetFocus
Exit Sub
End If
sqltxt1 = "select * from oper where 用户名='" + _
Trim(Text1.Text) + "'"
Set brs = exesql(sqltxt1)
If flag = 1 Then '添加操作
If brs.RecordCount <> 0 Then '原记录个数大于0
MsgBox "存在相同的记录", vbOKOnly, "信息提示"
Text1.SetFocus
brs.Close
Exit Sub
End If
brs.AddNew
brs.Fields("用户名") = Trim(Text1.Text)
brs.Fields("口令") = Trim(Text2.Text)
brs.Fields("级别") = Trim(Combo1.Text)
brs.Update
recs = recs + 1
Else '修改操作
Text1.Enabled = False
brs.Fields("用户名") = Trim(Text1.Text)
brs.Fields("口令") = Trim(Text2.Text)
brs.Fields("级别") = Trim(Combo1.Text)
brs.Update
End If
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
user = ""
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys "{TAB}"
End If
End Sub
Private Sub Form_Load()
Dim sqltxt As String
Dim sqltxt1 As String
Dim i As Integer
sqltxt = "select * from oper"
Set rs = exesql(sqltxt)
If flag = 2 Then
Text1.Text = rs.Fields("用户名")
Text2.Text = rs.Fields("口令")
Combo1.Text = rs.Fields("级别")
Text1.Enabled = False
End If
sqltxt1 = "select * from rlevel "
Set brs = exesql(sqltxt1)
Combo1.Text = brs.Fields("级别")
For i = 1 To brs.RecordCount
Combo1.AddItem brs.Fields("级别")
brs.MoveNext
Next i
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
Call endata(KeyAscii)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -