running totals selective year

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi
i have a table with cost records and a dateyear field
on my form i can use the =Sum([cost]) gives me running total but i would
like to add a text box that can use a public variable 'curyear' to select
currrent year totals. i have a query that does it but how do i get the text
box to show the calculated value of the query?
query:
SELECT Sum(mobileusage.cost) AS cost
FROM years INNER JOIN mobileusage ON years.yearidx=mobileusage.billdateyear
WHERE (((mobileusage.billdateyear)=(SELECT years.yearidx FROM years WHERE
((years.yearid)=[curyear]) ) ));

does that make sense?
David
 
Hi,


= DSUM("cost", "mobileusage", "billdateyear=" & curyear )




could do the job, isn't it?


Hoping it may help,
Vanderghast, Access MVP
 

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

Back
Top