We help IT Professionals succeed at work.
Get Started

Error 2471 using DLookUp

Last Modified: 2013-11-28
I'm trying to pull a value out of a query and filter it based on a value of a textbox.  I get the Error 2741 when I use either a hardcodes value like below, or when I use a reference to the textbox on the form.  Reservation Number is saved in the database as an integer.  The code that I'm using is:

DLookup("[Total Reservation Cost]", "qryTotalPassCost","tblReservations.[Reservation Number]=1")

qryTotalPassCost looks like this:

SELECT SUM([Total Pass Cost]) AS [Total Reservation Cost]
                   (SELECT IIf(tblPasses.IsDaily,[Number of Days],1)*tblPasses.[Pass Cost] AS [Total Pass Cost],
                   [Reservation  Number]
                             (SELECT tblReservations.[Reservation Number], [End Date]-[Start Date] AS [Number of Days],
                             [Fee Type], tblPasses.[Pass Cost], tblPasses.IsDaily
                             FROM tblReservations, tblGroupMembers, tblPasses
                             WHERE tblReservations.[Reservation Number]=tblGroupMembers.[Reservation Number] And
                             tblGroupMembers.[Fee Type]=tblPasses.[Pass Type])  
                             AS [%$##@_Alias])  
                  AS [%$##@_Alias];

Any help would be appreciated.
The really wierd thing is I can put a where condition on the query and it works fine, but if I copy and paste the where condition (minus the where)  I still get the error trying to run the dlookup function.
Watch Question
Top Expert 2010
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE