Solved

DLookup Question

Posted on 2016-09-17
3
31 Views
Last Modified: 2016-09-17
I am trying to use a DLookup with multiple criteria's but it's not working correctly. Can anyone take a look and see where I went wrong with the criteria's? I am trying to  match up the Employee's Name and a date field.


=DLookUp("[Wage]","qryWageLastMax","[EmpName]= " & Nz([cboEmpName],0) And "[WageDate]< " & [txtWageDate])

Open in new window

0
Comment
Question by:Lawrence Salvucci
  • 2
3 Comments
 
LVL 18

Accepted Solution

by:
crystal (strive4peace) - Microsoft MVP, Access earned 500 total points
Comment Utility
value of Empname probably needs quote delimiters and date probably needs # delimiters
The word And needs to be in the criteria string

=DLookUp("[Wage]","qryWageLastMax", "[EmpName]= '" & Nz([cboEmpName],0) & "' And [WageDate]< #" & [txtWageDate] & "#")

Open in new window

0
 
LVL 1

Author Closing Comment

by:Lawrence Salvucci
Comment Utility
Thank you very much Crystal! That worked perfectly! I get confused with all the double quotes and single quotes. :)
0
 
LVL 18
Comment Utility
you're welcome - happy to help ;)

if you are using double quotes to specify the criteria, then you can use single quotes inside that to delimit a text value UNLESS the text might have ' ... in which case, substitute "" (2 double quote marks) for each of the single quote marks ~
1

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Familiarize people with the process of utilizing SQL Server views 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 Microsoft Access…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

762 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

10 Experts available now in Live!

Get 1:1 Help Now