Solved

DLookup syntax issue

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

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, 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 …

707 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

15 Experts available now in Live!

Get 1:1 Help Now