Inputbox for password

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm so close, but I can't get the dlookup to pick up the field "password"
from the table Employees.

If InputBox("Please Enter a Password") =
"DLookup(
![Employees],[Employees]![Employee],[Employees]![Password]"
Then
Cancel = True

The table is [Employees], the Name of the field I want it to pull from is
"password" assigned to a field "employee". What is wrong with my equation.
(If you are confused about my design, it is because I am encrypting and
assigning passwords for other parts of the program, the backgound will be
locked up to non-administrative users.)
 
Get rid of the " characaters around the DLookup expression, and use the
correct syntax for DLookup (see the Help file):

If InputBox("Please Enter a Password") =
DLookup("Password", "Employees", "[Employee]=" &
VariableWithEmployeeValueInIt)
Then
Cancel = True
' etc.

The above assumes that Employee is a numeric field. If it's a text field,
then use this:

If InputBox("Please Enter a Password") =
DLookup("Password", "Employees", "[Employee]='" &
VariableWithEmployeeValueInIt & "'")
Then
Cancel = True
' etc.
 
hi,
the syntax looks all wrong.
here is syntax i use in one of my dbs. it works.
Me!txtDescription = DLookup
("[IMA_ItemName]", "IMA", "[IMA_ItemID] ='" & Me!
txtItemID & "'")
it gets the item's discription from table IMA where the
Item id in the table matches the item id i type into the
form.
basic syntax.....
dlookup("[field2]","table1","[field1]='"&me.textbox1&"'")

I think you would be looking for something like this

dlookup("[Password]","employees","[EmpID]='"& me.EmpID
&"'")
You cant just send it to find something. you have to
match something. i may be dconfused but i cant see where
you are matching anything. The only time you can get
around not matching is when you have a table with only 1
record in it. then you can say go get this field from
this table. otherwize you have to tell access which
record to get the field from. that is where the matching
comes in usually matching a primary key from a textbox on
your form.
hope this helps.
 
I'm so close, but I can't get the dlookup to pick up the field "password"
from the table Employees.

If InputBox("Please Enter a Password") =
"DLookup(
![Employees],[Employees]![Employee],[Employees]![Password]"
Then
Cancel = True

The table is [Employees], the Name of the field I want it to pull from is
"password" assigned to a field "employee". What is wrong with my equation.
(If you are confused about my design, it is because I am encrypting and
assigning passwords for other parts of the program, the backgound will be
locked up to non-administrative users.Ê¥µ®½Ú·¢ ɽµØ·¢»Ó»¹ÊǶԷ½ºó µçÊÓ»ú

¸´»î½ÚÊ¿´ó¿´·¨»ú Ê¿´ó·ò¼è¿à Èöµ©
 
Back
Top