Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 662
  • Last Modified:

dlookup help Access

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
correlate
Asked:
correlate
  • 3
1 Solution
 
mbizupCommented:
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
 
mbizupCommented:
<<
=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
 
correlateAuthor Commented:
perfect - thank you for the swift response
0
 
mbizupCommented:
Glad to help :)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now