Private Sub cmdOK_Click()
On Error GoTo Err_cmdOK_Click
Dim strSQL As String '操作查询SQL语句
Dim lngUserId As Long '系统自动分配给注册用户的用户ID
Dim lngRecordsAffected As Long '操作查询影响的记录行数
If IsNull(Me.txtUserName) Then
MsgBox "请输入用户名。", vbInformation
Me.txtUserName.SetFocus
ElseIf IsNull(Me.txtPassword) Then
MsgBox "请输入密码。", vbInformation
Me.txtPassword.SetFocus
ElseIf IsNull(Me.txtConfirmPwd) Then
MsgBox "请确认密码。", vbInformation
Me.txtConfirmPwd.SetFocus
ElseIf IsNull(Me.cboPrompt) Then
MsgBox "请输入密码提示问题。", vbInformation
Me.cboPrompt.SetFocus
ElseIf IsNull(Me.txtUserGroup) Then
MsgBox "请输入您所在CELL。", vbInformation
Me.txtUserGroup.SetFocus
ElseIf IsNull(Me.txtAnswer) Then
MsgBox "请输入密码提示问题的答案。", vbInformation
Me.txtAnswer.SetFocus
ElseIf StrComp(Me.txtPassword, Me.txtConfirmPwd, vbBinaryCompare) <> 0 Then
MsgBox "两次输入的密码不一致,请重新输入。", vbCritical
'Me.txtPassword = Null
' Me.txtConfirmPwd = Null
Me.txtPassword.SetFocus
ElseIf DCount("[FUserName]", "USysUsers", "[FUserName]='" & Me.txtUserName & "'") > 0 Then
MsgBox "用户名已经存在,请换一个其它用户名。", vbCritical
'Me.txtUserName = Null
Me.txtUserName.SetFocus
Else
If GetKeyState(VK_CAPITAL) <> 0 Then
If MsgBox("密码区分大小写,目前大写锁定键处于打开状态,请确保您知道密码的正确大小写形式。" & _
"是否继续?", vbQuestion + vbOKCancel) = vbOK Then Exit Sub
End If
If lngRecordsAffected <> 0 Then
MsgBox "注册成功!" & vbCr & "您的用户ID为:" & lngUserId, vbInformation
Call cmdCancel_Click
End If
End If
End If
Exit_cmdOK_Click:
Exit Sub
Err_cmdOK_Click:
MsgBox Me.Name & " cmdOK_Click" & vbCr & Err.Description, vbCritical
'写入错误日志
PutErrorLog acForm, Me.Name, "cmdOK_Click"
Resume Exit_cmdOK_Click