Solved

Subtotal on Main Form

Posted on 2012-04-01
6
210 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
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

910 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

20 Experts available now in Live!

Get 1:1 Help Now