2016-09-28 1 views
-3

タイプミスマッチエラーが発生しているので、間違っていることがわかりません。タイプミスマッチエラー何をすべきかわからない

これは私がこれまでにしようとしているものです:

Private Sub Command1_Click() 
Dim UserLevel As Integer 

If IsNull(Me.txtLoginID) Then 
    MsgBox "Please Enter Login ID", vbInformation, "Login ID Required" 
    Me.txtLoginID.SetFocus 
ElseIf IsNull(Me.txtPassword) Then 
    MsgBox "Please Enter Password", vbInformation, "Password Required" 
    Me.txtPassword.SetFocus 
Else 
    If (IsNull(DLookup("UserLogin", "Accounts", "UserLogin='" & Me.txtLoginID.Value & "'"))) Or _ 
    (IsNull(DLookup("Password", "Accounts", "Password='" & Me.txtPassword.Value & "'"))) Then 
     MsgBox "Incorrect Login ID or Password" 
    Else 
     UserLevel = DLookup("UserSecurity", "Accounts", "UserLogin= '" & Me.txtLoginID.Value & "'") 
     DoCmd.Close 
      If UserLevel = admin Then 
     DoCmd.OpenForm "Administrator" 
    Else 
     DoCmd.OpenForm "Sales" 
     End If 
    End If 
End If 
+1

どの行でエラーがスローされますか? – Andre

答えて

0

はNzがであなたのIsNullを交換してみてください:

If Nz(DLookup("UserLogin", "Accounts", "UserLogin='" & Me.txtLoginID.Value & "'")) Or _ 
Nz(DLookup("Password", "Accounts", "Password='" & Me.txtPassword.Value & "'")) Then 
    MsgBox "Incorrect Login ID or Password" 
関連する問題