Solved

Subtotal on Main Form

Posted on 2012-04-01
6
211 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

813 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

10 Experts available now in Live!

Get 1:1 Help Now