A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Dlookup based on a Text field?



 
 
Thread Tools Display Modes
  #1  
Old September 28th, 2009, 10:18 PM posted to microsoft.public.access.gettingstarted
Charess
external usenet poster
 
Posts: 16
Default 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  
Old September 28th, 2009, 10:33 PM posted to microsoft.public.access.gettingstarted
Beetle
external usenet poster
 
Posts: 1,254
Default 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  
Old September 28th, 2009, 11:18 PM posted to microsoft.public.access.gettingstarted
Gina Whipp
external usenet poster
 
Posts: 3,500
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:23 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.