Solved

DLookup syntax issue

Posted on 2014-01-16
3
307 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
  • 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

786 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