Syntax issue in DLookup

I'm getting a syntax error with:

= DLookup("[QtyTransferred]", "query3", "[OwnerName] = 'John Doe ABC' & " AND [Crop] = '" & [Reports]![rptInventoryOwnership]![txtCrop2] & "'")

NOTE:  An expert helped me with a very similar issue a couple of days ago.  I hope someone can figure this one out for me.
SteveL13Asked:
Who is Participating?
 
Dale FyeConnect With a Mentor Commented:
= DLookup("[QtyTransferred]", "query3", "[OwnerName] = 'John Doe ABC' AND [Crop] = '" & [Reports]![rptInventoryOwnership]![txtCrop2] & "'")
1
 
Anders Ebro (Microsoft MVP)Connect With a Mentor Microsoft DeveloperCommented:
The & sign is used to "piece" together your string. "demo" & "2" results in "demo2". Now the final expression has to be readable by the query engine. If in doubt, place a breakpoint on the line of code, copy the part from the 3rd parameter/argument of the dlookup, directly into the immediate window, and place a ? in front of it and hit enter. The result should illustrate what the "final" string will look like.
0
All Courses

From novice to tech pro — start learning today.