Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel 当我只使用数字作为密码时,它不会被检测到_Excel_Vba - Fatal编程技术网

Excel 当我只使用数字作为密码时,它不会被检测到

Excel 当我只使用数字作为密码时,它不会被检测到,excel,vba,Excel,Vba,我使用密码创建了一个数据库帐户,该密码只包含数字,当我尝试使用该帐户登录时,系统拒绝并显示消息框“对不起,您输入的密码错误!” 这意味着,如果我在数据库中仅使用数字密码创建帐户,它将不会被检测为正确的密码 我真的很感激能纠正我编码错误的人 Private Sub BTLogin_Click() If txtusername.Value = "" Or txtpass.Value = "" Then MsgBox "User

我使用密码创建了一个数据库帐户,该密码只包含数字,当我尝试使用该帐户登录时,系统拒绝并显示消息框“对不起,您输入的密码错误!”

这意味着,如果我在数据库中仅使用数字密码创建帐户,它将不会被检测为正确的密码

我真的很感激能纠正我编码错误的人

Private Sub BTLogin_Click()
    If txtusername.Value = "" Or txtpass.Value = "" Then
        MsgBox "Username / Password cannot be empty!", vbExclamation, "Warning"
        txtusername.SetFocus
    Else
        Dim iRow As Long
        Dim Ws As Worksheet
        Set Ws = Worksheets("Administrator")
        iRow = Ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
                 If WorksheetFunction.CountIf(Ws.Range("A3", Ws.Cells(iRow - 1, 3)), Me.txtusername.Value) > 0 Then
                      Nomor = Trim(Me.txtusername.Value)
                      With Sheets("Administrator")
                                Baris = .Columns("A").Find(Nomor).Row
                                PasswordUser = Range("B" & Baris).Value
                       End With
                       If txtpass.Value <> PasswordUser Then
                           MsgBox "Sorry, the password you entered is wrong!", vbCritical, "Error"
                           txtpass.Text = ""
                           txtpass.SetFocus
                       Else
                           MsgBox "Login Success", vbInformation, "Success"
                           Unload Me
                           Application.Visible = True
                       End If
                 Else
                       MsgBox "User not registered. Please contact the administrator", vbCritical, "Warning"
                       txtusername.Text = ""
                       txtpass.Text = ""
                       txtusername.SetFocus
                   Exit Sub
                   End If
    End If
End Sub
Private Sub BTLogin\u Click()
如果txtusername.Value=”“或txtpass.Value=“”,则
MsgBox“用户名/密码不能为空!”,VBE感叹号,“警告”
txtusername.SetFocus
其他的
暗淡无光
将Ws设置为工作表
设置Ws=工作表(“管理员”)
iRow=Ws.Cells(Rows.Count,1).End(xlUp).Offset(1,0).Row
如果WorksheetFunction.CountIf(Ws.Range(“A3”,Ws.Cells(iRow-1,3)),Me.txtusername.Value)>0,那么
Nomor=Trim(Me.txtusername.Value)
附页(“管理员”)
Baris=.Columns(“A”).Find(Nomor).Row
PasswordUser=Range(“B”和Baris).Value
以
如果txtpass.Value密码用户,则
MsgBox“对不起,您输入的密码错误!”,vbCritical,“错误”
txtpass.Text=“”
txtpass.SetFocus
其他的
MsgBox“登录成功”,vbInformation“成功”
卸下我
Application.Visible=True
如果结束
其他的
MsgBox“用户未注册。请与管理员联系”,vbCritical,“警告”
txtusername.Text=“”
txtpass.Text=“”
txtusername.SetFocus
出口接头
如果结束
如果结束
端接头

如果txtpass.Value CStr(密码用户)那么
非常感谢你,兄弟最后,我爱你