Solved

DLookup Question

Posted on 2016-09-17
3
54 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 20

Accepted Solution

by:
crystal (strive4peace) - Microsoft MVP, Access earned 500 total points
ID: 41803470
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
ID: 41803473
Thank you very much Crystal! That worked perfectly! I get confused with all the double quotes and single quotes. :)
0
 
LVL 20
ID: 41803478
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

738 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