Solved

dlookup help Access

Posted on 2013-01-16
4
620 Views
Last Modified: 2013-01-16
Dear Experts,

For the life of me I can't get this dlookup to work

=DLookUp("[Gen-FirstName]","[Main]","[EmployeeID]= '" & [EmployeeID] & "'")

I've tried various different methods, but all fail

=DLookUp("[Gen-FirstName]","Main","[EmployeeID]= '" & [Me].[EmployeeID] & "'")

Gen-FirstName is the field I want returned from the table "Main"

The link is EmployeeID (Autonumber in Main) & a long interger number in the table behind the form I'm using (Table = "HR Log")

Can anybody help
0
Comment
Question by:correlate
  • 3
4 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 38782277
Try it like this:

=DLookUp("[Gen-FirstName]","[Main]","[EmployeeID]= " & [EmployeeID])

Open in new window


(The single quote delimiters should only be used for text fields - EmployeeID is numeric, so it should not be delimited)
0
 
LVL 61

Expert Comment

by:mbizup
ID: 38782286
<<
=DLookUp("[Gen-FirstName]","[Main]","[EmployeeID]= " & [EmployeeID])

>>

Also, make sure you are using the name of the table and field you're looking this up in (not the name of the form and textbox)

>> I'm using (Table = "HR Log")

If your table's name is HR Log, you would use that in the DLookup:


=DLookUp("[Gen-FirstName]","[HR Log]","[EmployeeID]= " & [EmployeeID]) 

Open in new window


Jim Dettman's article explains this stuff very thoroughly:
http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_12-Dlookup-and-the-Domain-Functions.html
0
 

Author Closing Comment

by:correlate
ID: 38782297
perfect - thank you for the swift response
0
 
LVL 61

Expert Comment

by:mbizup
ID: 38782300
Glad to help :)
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question