[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

DLookup syntax issue

Posted on 2014-01-16
3
Medium Priority
?
320 Views
Last Modified: 2014-01-16
What is wrong with this:

Me.txtGrowDaysEarly = DLookup("GrowDaysEarly", "tblCatalog", "TextMnumber = = '" & (Nz(Me![cboTextMnumber], 0)) & "'")

TextMnumber  is a text field.
0
Comment
Question by:SteveL13
[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 48

Expert Comment

by:Dale Fye
ID: 39785328
two = = signs
 
Me.txtGrowDaysEarly = DLookup("GrowDaysEarly", "tblCatalog", "TextMnumber = '" & (Nz(Me.cboTextMnumber, 0) & "'")
0
 

Author Comment

by:SteveL13
ID: 39785348
Still a syntax error
0
 
LVL 48

Accepted Solution

by:
Dale Fye earned 2000 total points
ID: 39785379
There was an extra (

Me.txtGrowDaysEarly = DLookup("GrowDaysEarly", "tblCatalog", "TextMnumber = '" & Nz(Me.cboTextMnumber, 0) & "'")

I normally do:

Dim strCriteria as string
strCriteria = "TextMnumber = '" & Nz(Me.cboTextMnumber, 0) & "'"
debug.print strCriteria
Me.txtGrowDaysEarly = DLookup("GrowDaysEarly", "tblCatalog", strCriteria)

Although this is longer, it gives me the opportunity to test the criteria that is going to be evaluated.
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
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 use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

650 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