?
Solved

Subtotal on Main Form

Posted on 2012-04-01
6
Medium Priority
?
221 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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

764 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