??
字號:
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 + -