If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Dlookup based on a Text field?
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 |
#2
|
|||
|
|||
Dlookup based on a Text field?
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" wrote: 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 |
#3
|
|||
|
|||
Dlookup based on a Text field?
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/Ap****ueBadWord.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" wrote in message ... 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" wrote: 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 |
Thread Tools | |
Display Modes | |
|
|