Solved

DLookup syntax issue

Posted on 2014-01-16
3
310 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 47

Expert Comment

by:Dale Fye (Access MVP)
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 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
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…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

726 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