Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Subtotal on Main Form

Posted on 2012-04-01
6
Medium Priority
?
227 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 20

Accepted Solution

by:
clarkscott earned 2000 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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

604 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