Solved

Subtotal on Main Form

Posted on 2012-04-01
6
208 Views
Last Modified: 2012-08-13
I have a field (InvoiceSubTotal) on a Main form that is linked to the Subtotal field on the subform's footer. =[sfrmInvoiceDetails].[Form]![subtotal] This works correctly.  

I want that value to also appear in the bound InvoiceTotal field.  I have tried to put code on the InvoiceSubTotal AfterUpdate event but nothing happens.  How do I get the subform's SubTotal to appear in the bound InvoiceTotal field.  Thanks for your help.
0
Comment
Question by:Sasha42
6 Comments
 

Author Comment

by:Sasha42
ID: 37794492
Btw, a year's worth of invoice totals were put in the database without having invoice details.  So I can't just make the Invoice Total field a calculated field.
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 37794512
I'm a bit confused about what you mean by getting the subform's SubTotal to appear in the bound InvoiceTotal field.  Since it's bound to the InvoiceTotal field and you already have a year's worth of invoice totals, doesn't it already have a value there?
0
 
LVL 9

Expert Comment

by:suvmitra
ID: 37794560
You need to use an Unbound text box may be in the Report Footer or Group the Field and populate the Total value in the after update event.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 20

Accepted Solution

by:
clarkscott earned 500 total points
ID: 37795421
Use a function to get your results.  You can use it anywhere.

Create a query that SUMS the field you need.

In a module, create a function to retrieve this value from the query.


Function GetTotals() as currency
Dim db as dao.database
dim rst as dao.recordset
set db = codedb
set rst = db.openrecordset("YourQuery",dbopensnapshot)
rst.movefirst
GetTotals = rst!YourSum
rst.close
db.close
set rst = nothing
set db = nothing
End Function


Scott C
0
 
LVL 20

Expert Comment

by:clarkscott
ID: 37795422
Whoops.... in the text field of your Main form ...  control source:  =GetTotals()

Scott C
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37796504
<I want that value to also appear in the bound InvoiceTotal field. >
You cannot make calculated fields appear in "bound" fields...
(inserting calculated data into a field will typically create "redundant" data...)
...you also did not stated where this mystery field/control was located...?

As always, you should first always fully explain your design, ...then explain, in detail, what your ultimate goal is...
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now