?? frmoperator.frm
字號:
Begin VB.TextBox txtPassword
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
IMEMode = 3 'DISABLE
Left = 2640
MaxLength = 6
PasswordChar = "*"
TabIndex = 1
ToolTipText = "4到6位"
Top = 2880
Width = 975
End
Begin VB.Label Label2
Alignment = 2 'Center
Caption = "確認"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 3720
TabIndex = 9
Top = 3000
Width = 615
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "工號"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 8
Top = 3000
Width = 615
End
Begin VB.Label Label3
Alignment = 2 'Center
Caption = "密碼"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 1920
TabIndex = 7
Top = 3000
Width = 615
End
End
Attribute VB_Name = "frmOperator"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdClear_Click()
txtID.Text = ""
txtPassword.Text = ""
txtConfirm.Text = ""
End Sub
Private Sub cmdDel_Click()
Dim nTmp As Integer
Dim nRet As Integer
On Error Resume Next 'CallerID
With AdodcCaller.Recordset
If .EOF Or .BOF Or .RecordCount < 1 Then
cmdDel.Enabled = False
Exit Sub
End If
nTmp = ![ID]
nRet = MsgBox("確信刪除工號" + Trim(Str(nTmp)) + "嗎?", vbQuestion + vbYesNo, "提示")
If nRet = 6 Then
If nTmp = ID_SUPER Then
MsgBox ts(ID_SUPER) + "為超級用戶,不可刪除!", vbCritical + vbOKOnly, "失敗"
Exit Sub
End If
.Delete
.Requery
AdjustNumber AdodcCaller, 0
End If
End With
End Sub
Private Sub cmdOK_Click()
Dim nTmp As Integer
Dim bAddNew As Boolean
On Error Resume Next 'CallerID
nTmp = Val(txtID.Text)
If nTmp < ID_SUPER Or nTmp > 9999 Then
MsgBox "工號必須在1001至9999之間!", vbQuestion + vbOKOnly, "提示"
txtID.SetFocus
Exit Sub
End If
If Len(txtPassword.Text) < 4 Then
MsgBox "密碼必須取4至6位!", vbQuestion + vbOKOnly, "提示"
txtPassword.SetFocus
Exit Sub
End If
If CheckLegalChars(txtPassword.Text, ALL_CHAR_SET) = False Then
MsgBox "密碼必須取數字或字母!", vbQuestion + vbOKOnly, "提示"
txtPassword.SetFocus
Exit Sub
End If
If txtPassword.Text <> txtConfirm.Text Then
MsgBox "初始密碼與確認密碼必須一致!", vbQuestion + vbOKOnly, "提示"
txtPassword.SetFocus
Exit Sub
End If
With AdodcCaller.Recordset
If .RecordCount < 1 Then
bAddNew = True
Else
If nOperatorID <> ID_SUPER And nOperatorID <> nTmp Then
MsgBox "您無權修改" + Trim(Str(![ID])) + "的密碼!", vbCritical + vbOKOnly, "失敗"
Exit Sub
End If
End If
If nOperatorID = ID_SUPER Then 'And nTmp <> nOperatorID Then
.MoveFirst
Do While Not .EOF
If ![ID] = nTmp Then Exit Do
.MoveNext
Loop
If .EOF Then
bAddNew = True
Else
![Password] = Base64_Encode(txtPassword.Text) 'ID_SUPER or others by ID_SUPER
GoTo ENDMARK
End If
End If
If bAddNew = True Then
If .RecordCount < 1 And nTmp <> ID_SUPER Then
MsgBox "初次建立員工信息,必須首先設置超級用戶" + ts(ID_SUPER), vbCritical + vbOKOnly, "提示"
Exit Sub
End If
On Error GoTo LAST_MARK
.AddNew
![ID] = nTmp
![Password] = Base64_Encode(txtPassword.Text)
If .RecordCount = 1 Then nOperatorID = nTmp
End If
If nOperatorID = nTmp Then 'others by others
![Password] = Base64_Encode(txtPassword.Text)
strOperatorPassword = txtPassword.Text
End If
ENDMARK:
.Update
End With
frmMain.GetCorpInfo
LAST_MARK:
End Sub
Private Sub cmdQuit_Click()
Unload Me
End Sub
Private Sub DataGrid1_Click()
On Error Resume Next 'CallerID
With AdodcCaller.Recordset
If .EOF Or .BOF Or .RecordCount < 1 Then Exit Sub
txtID.Text = ![ID]
txtPassword.Text = Base64_Decode(![Password])
txtConfirm.Text = Base64_Decode(![Password])
End With
End Sub
Private Sub Form_Load()
On Error Resume Next 'CallerID
With AdodcCaller
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + _
strDataPath + ";Persist Security Info=False"
.CommandType = adCmdUnknown
.RecordSource = "select * from Operators order by [ID]"
.Refresh
With .Recordset
If .RecordCount > 0 Then
.MoveFirst
Do While Not .EOF
If nOperatorID = ![ID] Then
txtID.Text = ![ID]
txtPassword.Text = Base64_Decode(![Password])
txtConfirm.Text = txtPassword.Text
Exit Do
End If
.MoveNext
Loop
Else
txtID.Enabled = True
GoTo END_MARK
End If
End With
End With
If nOperatorID = ID_SUPER Then
cmdDel.Enabled = True
txtID.Enabled = True
Else
cmdDel.Enabled = False
txtID.Enabled = False
End If
Me.Caption = Me.Caption + " (操作員:" + Trim(Str(nOperatorID)) + ")"
END_MARK:
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -