Solved

DLookup Question

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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.

911 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

19 Experts available now in Live!

Get 1:1 Help Now