Dlookup based on a Text field?

C

Charess

I have a form called frmEmployee Details, in which I would like to have the
details populate off of employee name(this will include their first & last
name) which is included in a table that has all the employee details called
tblEmployee_Lookup. When I try this with the following formula I get an error:

=DLookUp("[Big6]","tblEmployee_Lookup","[Name]= " &
Forms!frmEmployee_Details!Name)

However, when I based the formula on the employee id number it works. I know
that it is better to use a unique number than name, but this database is for
a particular set of users that need to have it be based off the employee's
name. Any advice?

Thank you.
Charess
 
B

Beetle

Since the Name field is a text data type you need to use
quote delimiters in the DLookup;

=DLookUp("[Big6]","tblEmployee_Lookup","[Name]= """ &
Forms!frmEmployee_Details!Name & """")

For clarity, that's three double quotes after "[Name]= and
four double quotes before the closing parentheses.
 
G

Gina Whipp

Sean,

In addition to what Beetle said it should be noted the *Name* is a Reserved
Word in Access. You should avoid using those because Access will become
confused. For a complete list see...

http://allenbrowne.com/AppIssueBadWord.html

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Beetle said:
Since the Name field is a text data type you need to use
quote delimiters in the DLookup;

=DLookUp("[Big6]","tblEmployee_Lookup","[Name]= """ &
Forms!frmEmployee_Details!Name & """")

For clarity, that's three double quotes after "[Name]= and
four double quotes before the closing parentheses.

--
_________

Sean Bailey


Charess said:
I have a form called frmEmployee Details, in which I would like to have
the
details populate off of employee name(this will include their first &
last
name) which is included in a table that has all the employee details
called
tblEmployee_Lookup. When I try this with the following formula I get an
error:

=DLookUp("[Big6]","tblEmployee_Lookup","[Name]= " &
Forms!frmEmployee_Details!Name)

However, when I based the formula on the employee id number it works. I
know
that it is better to use a unique number than name, but this database is
for
a particular set of users that need to have it be based off the
employee's
name. Any advice?

Thank you.
Charess
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top