Solved

DLookup syntax issue

Posted on 2014-01-16
3
312 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 (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 48

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

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