Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Summing Top Values from a SubForm on a Main Form 1

Status
Not open for further replies.

TCARPENTER

Programmer
Mar 11, 2002
766
0
0
US
I have a sub form which displays as a data sheet and in the form footer, I have an unbound text box with the sum I need, and then on my main form, I have another unbound text box with it's source set to the text box on my sub form.

Then I realized I need to sum the top 4 values - not all of them. I thought I could change my unbound text box source from =Sum([Bars]) to =Sum(Select Top 4 Bars from Scores) - but I keep getting the dreaded #Error.

How do I do this?
 
As you have discovered, this won't work. You can't use a SQL statement in a control source. You can create a saved totals query that can be queried using DLookup() or DSum().

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top