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],
(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])
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.