Solved

dlookup help Access

Posted on 2013-01-16
4
604 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now