in a report group footer I have a DSUM function like...
Tripsheet is a query which accepts parameters, now how do i pass these parameters to the query through the dsum ()?? my query will not execute if i dont pass these parameters. by the way this report is bound to the trip sheet query so is there any other way in which i can find out in a report group the sum off all the fees whose value is "$4.50"
Can you modify your query so that instead of requesting parameters it pulls them from a form (the one that called the report) or from global variables (which your report can set)?
Yes, you can sum the total of all fees that meet your criteria. This method would work if you put it in your report footer:
=Sum(IIf([Fees] = 4.50,[Fees],0))
...but I can't shake the feeling that the problem is in your application concept. Is 4.50 the only value you want to total? Are you going to hard-code this value into your application? If your report is based on the same query, how is it getting the parameters?
I am sure there is a solution to your problem that would not be complex.
I would have been curious to see how this story ended. Let's say we input the parameters from the query (you know the stuff between brackets in the query grid...?). How this criteria would be transfered to the dsum function ?
It does not work that way. Except by using a reference to a control or to a Public variable you cannot pass a parameter to a query object in code.
There are several alternatives though but they all demand some coding skills:
- You can use a function that dynamically build the query and pass the parameter(s) to that function.
- You can use an ADO query, but it's also using code.
- You can create a Class Module acting like a query and accepting parameters, but here again you have to write some code.
A query in Access is a hybrid object between a Stored Procedure (that accepts true parameters) and a View (that does not) in a SQL server. The ADO query method mimics a stored prodecure in SQL.