DSUM in Form

  • Thread starter Thread starter Gator
  • Start date Start date
G

Gator

I have a textbox on a form where =DSum("Amount","TreasurerDeposits") returns
the sum from a table...it works....why can't I do this for a query? What do
I do to get total from query....is there any SQL that will do it?
i have a subform showing records from a query and I want a textbox to show
the total of a field from the query. what code or SQL can do this?
 
You could just use DSum. To Access, tables and queries are pretty much
interchangeable everywhere.
 
OK for some reason my query lost it's datasource...i fixed it. But, on the
subform's datasheet, I want the textbox's sum to work in the event that I use
the Filter by Selection in the datasheet. Right now it is showing the sum of
all the records in the table despite a filter. If I Filter by Selection, I
want the textbox to sum only the filtered records, not all the records.
Regards,
Gate
 
You'd need to have a Where clause in your DSum corresponding to the Filter.

You could try

=DSum("Amount","qryTreasurerDeposits", Forms!NameOfForm.Filter)

Note that you'll need to put code in the form's Filter event to requery the
text box.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Dsum in Tabbed Form 1
Dsum Issues 0
DSum Confusion 4
Sum Where Date is less than certain date 5
Dsum is killing me 1
dsum sytax error 5
DSum ? Question 2
DSum Question 1

Back
Top