login form problem ?

Dlovan-IT

Registered User.
Local time
Tomorrow, 00:32
Joined
Oct 9, 2013
Messages
84
hello all friend

i have an database application and have been a login form content of Username and Password , i want when the user wrote wrong username said the username is incorrect and when wrote wrong password said the password is incorrect if both of them means username & password said both of them is incorrect how to do it ? i do it but not working look my attachment
 

Attachments

Something like this?
Code:
Private Sub Command4_Click()
    Dim logErr As Long
    If Len(Me.T0 & vbNullString) = 0 Or DCount("*", "T", "user = '" & Nz(Me.T0, vbNullString) & "'") = 0 Then
        logErr = logErr + 1
    End If
    
    If Len(Me.T1 & vbNullString) = 0 Or Nz(DLookup("pass", "T", "user = '" & Nz(Me.T0, vbNullString) & "'"), "N/A") = "N/A" Then
        logErr = logErr + 1
    End If
    
    If logErr <> 0 Then MsgBox "Invalid " & IIf(logErr = 2, "User Name & Password", "Password") & " entered, please try again !!", vbCritical
End Sub
 
Something like this?
Code:
Private Sub Command4_Click()
    Dim logErr As Long
    If Len(Me.T0 & vbNullString) = 0 Or DCount("*", "T", "user = '" & Nz(Me.T0, vbNullString) & "'") = 0 Then
        logErr = logErr + 1
    End If
    
    If Len(Me.T1 & vbNullString) = 0 Or Nz(DLookup("pass", "T", "user = '" & Nz(Me.T0, vbNullString) & "'"), "N/A") = "N/A" Then
        logErr = logErr + 1
    End If
    
    If logErr <> 0 Then MsgBox "Invalid " & IIf(logErr = 2, "User Name & Password", "Password") & " entered, please try again !!", vbCritical
End Sub

it was not working bro !!!
 
Explain what is not working "bro" !

"It's not working" interpretations :

  • There was a compiler error
  • There was a Run time error with error number xx and description "so and so".
  • The Error message occurs even if the right information was passed.
  • The error message is validating wrong credentials.
  • I do not know how to do it !
 
when i click on login button not happen for example if i put correct user & pass display message box said Welcome i want that can u do it ?
 
when i click on login button not happen for example if i put correct user & pass display message box said Welcome i want that can u do it ?
That I can, but you never mentioned anything like that before? :rolleyes: Your basic requirement was to check User name password that's all..

EDIT: Changed attachment !
 

Attachments

Last edited:
my friend it is wrong !!!! listen to me what i want

if the user put correct username & password display messagebox said : Welcome , if put correct username but wrong Password said :your user name is wrong , if put correct password but wrong username said : Password is wrong , if username & password is wrong said : both of them is wrong .
 
Check the post again, I have amended the code.
 
thanks so much friend know it was working thanks so much
 

Users who are viewing this thread

Back
Top Bottom