?
Solved

#name error on dlookup field in MS Access report

Posted on 2012-09-13
2
Medium Priority
?
1,861 Views
Last Modified: 2012-09-13
Hi there

I have a DLOOKUP function on a field in a MS Access report that is returning a #NAME? error.  The syntax for the function is:

=DLookUp("[Change]","[qry_PYTD_vs_CYTD_Performance_BBLS_Pct]","[ProductLongName]=[txtProductLongName]")

The "Change" value is calculated as: ([FY1213]-[FY1112])/[FY1112] and is noted as an expressions whereas the FY1112 and FY1213 values are Summed.  So, in the query, you have:

ProductLongName
FY112 - Sum
FY1213 - Sum
Change - Expression

Can someone explain to me why this is not working?  I have DSUM functions in the same report and they are working quite well.

Thanks!
0
Comment
Question by:staceymoore
  • 2
2 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 1000 total points
ID: 38395076
Try this:

=DLookUp("[Change]","[qry_PYTD_vs_CYTD_Performance_BBLS_Pct]","[ProductLongName]= '" & [txtProductLongName] & "'")

Open in new window

0
 
LVL 61

Expert Comment

by:mbizup
ID: 38395079
The above is for ProductLongName as a text field.  If it is numeric, try this:

=DLookUp("[Change]","[qry_PYTD_vs_CYTD_Performance_BBLS_Pct]","[ProductLongName]= " & [txtProductLongName] )

Open in new window

0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

862 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