VBA Login form issues

Neilster

Registered User.
Local time
Today, 14:46
Joined
Jan 19, 2014
Messages
218
Hi guys

Since I have split my database I'm having trouble with this piece of code on my login form.

PHP:
If Me.txtPassword.Value = DLookup("EmpPassword", "TblEmployee", "[EmpID] =" & Me.cboEmployee.Value <> "'") Then

        MyEmpID = Me.cboEmployee.Value


When you update the users password it comes up with incorrect password and will only accept the password for the 1st user in the table for any user.

Hope that makes sense. I think it's because of this syntax < > ""
 
If Me.txtPassword.Value = Nz(DLookup("EmpPassword", "TblEmployee", "[EmpID] =" & Me.cboEmployee.Value ), "") <> "" Then
 
Thanks for the reply, however it's giving me a syntax error missing operator message.
 
The EmpID is numeric.

If I go to the property feild of cboEmployee and click on data tab and change the bound column from 2 to 1 it works fine. If I change it back to 2 again you can login with any user and it will only except the password from the first user in the table.?
 
numeric of text:

If Me.txtPassword.Value = Nz(DLookup("EmpPassword", "TblEmployee", "[EmpID] ='" & Me.cboEmployee.Value & "'"), "") <> "" Then
 
That doesn't work either.

What I have done is set the column bound to 1and it works fine, however I have text in the combobox that says 'Enter Username' when the form opens. that disappears when the user enters there name.

Now that I have set the column bound to 1 the text 'Enter Username' doesn't appear in the combobox anymore???
 
I have managed to get this code to work, however it now allows you to enter a username and then you can enter any password you want and it will let you in?? why is this happening ?

Please help (-:

If Me.txtPassword.Value = Nz(DLookup("EmpPassword", "TblEmployee", "[EmpID] ='" & Me.cboEmployee.Value & "'"), "") <> "" Then

MyEmpID = Me.cboEmployee.Value
 
why not use textboxt to make it simple.
 
What I mean is, since spliting the database to frontend and backend the code below no longer works corretly on the login form.?



If
Me.txtPassword.Value = DLookup("EmpPassword", "TblEmployee", "[EmpID] =" & Me.cboEmployee.Value) Then

MyEmpID
= Me.cboEmployee.Value


If the database isn't slplit then the code works fine on the login form.
 
relink the table again.
 
Yeh tried that loads of times. I just can't understand why it would make any difference if it was split or not.
 
should work whether split or not. one thing, this is not related. i noticed that you are using dlookup when you can saved the password on your combo. using your combos rowsource:

select empID, empPassword, empName from tblEmployee

set column counts to 3.
hide the first two columns, column widths:0,0,1
now instead of dlookup you can just look at column(1) for the password:

if me.txtPassword.Value = me.combo.column(1) then
MyEmpID = Me.cboEmployee.Value
 
(-: so far so good!

Let me test it a little more and I will keep you updated, Thanks so far though.
 

Users who are viewing this thread

Back
Top Bottom