Solved

DLookup Question

Posted on 2016-09-17
3
45 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 19

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 19
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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
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.
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…

810 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