help needed in login form

rashidzaib

Registered User.
Local time
Today, 14:54
Joined
Aug 12, 2007
Messages
32
hy bro and sis
i am facing problem in login form
i have created on form based on table user have field name and password
actualy when i open then form the first record in table is appearing in form.
also when i am entering the first record of user name and password it is proceding the other user name password is not working. and third problem when i am entering the user name and password it is actually updating the first record. can any one sole my problem. this is my third post in this forum and i am not been able to find any good reply. i am new to access. i have oracle experince.
my code is given below

Private Sub CMDLOGIN_Click()

Me.CMDLOGIN.SetFocus
Dim USERNAME As String
Dim Flag As Boolean

Flag = False


If IsNull(Me.USERNAME) Or Me.USERNAME = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.USERNAME.SetFocus
Exit Sub
End If


If IsNull(Me.PASSWORD) Or Me.PASSWORD = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.PASSWORD.SetFocus
Exit Sub
End If

USERNAME = DLookup("[USERNAME]", "USERTABLE")


If Me.PASSWORD.Value = DLookup("[PASSWORD]", "USERTABLE") Then


DoCmd.Close acForm, "USERTABLE1", acSaveNo
DoCmd.OpenForm "JAWDAH"



Do Until Flag = True

If Me.PASSWORD <> DLookup("PASSWORD", "USERTABLE") Then
Flag = False
Else
Flag = True
End If

Loop
Else
MsgBox "The Password You Entered Is Invalid. Please Try Again", vbOKOnly, "Invalid Password"
Me.PASSWORD.SetFocus

End If


End Sub



Private Sub CMDLOGIN_Exit(Cancel As Integer)


End Sub

Private Sub PASSWORD_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
CMDLOGIN_Click
End If
End Sub

Private Sub USERNAME_Enter()

End Sub

Private Sub USERNAME_Exit(Cancel As Integer)


End Sub


any response should realy be appriciated.
very dishearted but still waiting for reply
 
you shouldnt name your text boxes the same name as your fields in your tables.
they should read something like

txtpass
txtusername.

Having them the same name as the field in the table is the reason you are getting them over written... They are bound to that field. Create 2 UNBOUND fields on the form to replace them.

Then
Code:
USERNAME = DLookup("[USERNAME]", "USERTABLE") 
If Me.PASSWORD.Value = DLookup("[PASSWORD]", "USERTABLE") Then
This line should read something like
Code:
If Me.txtPass.Value = DLookup("PASSWORD", "USERTABLE", "[USERNAME]= """ & txtName & """")  Then
 
login form problem

hy sir
thank u very much for reply.
i have solved most of the problem here just only one problem remaining that
i have in table three user and three different password but my form is just only taking first password for all user.
the sugestion which u have gave to me for changing the name on form also working same also i tried the criteria which u gave me is giving error
If Me.txtPASSWORD.Value = DLookup("PASSWORD", "USERTABLE", "USERNAME="""& txtUSERNAME &"""")
is giving error
any further solution for me
thank u very much
waiting for ur reply
take care
bye
 
problem of login screen
this is working now i have made changes now and this is working fine
thank u very much for reply
bye
 
Login Form

Hy Sir
My Login Form Is Working But Here One More Problem Remaining Problem Is This
That It Not Case Sensitive . If I Am Type Password In Capital Or Small Letter It Is Accepting
Any Solution For This
Thank U Very Much
Waiting For Ur Reply
Bye
 
Access Jet Engine is not case sensitive. you would need to add additional code to get this function to run
 

Users who are viewing this thread

Back
Top Bottom