Solved

dlookup help Access

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

680 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