473,382 Members | 1,353 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Subtotal From Subform To Mainform

I have an Invoice/Invoice Details form/subform. In the page footer of the
Invoice Details subform I have a textbox with the control source set to
=Sum([SalesAmount]). I then pull this value into the main form with a textbox
whose control source is =[SFrmInvoiceDetails]![TotalSalesAmount]. This works
fine when there are one or more line items in Invoice Details but on a new
invoice before any invoice details are entered, the textbox on the main form
shows #Error. I would like it to show $0.00. I have tried the NZ function in
different places without success; I keep getting #Error no matter what I try
when there are no records in the subform. What is the correct way to set this up
so that the main form shows $0.00 when there are no records in the subform and
then the total of the line items after one or more line items are entered?

Thanks for all help!

Charlene
Nov 12 '05 #1
3 5824
Suggestions:

1. Check that the subform text box is in the Form Footer section, not the
Page Footer section. It does make a difference.

2. Try changing the Control Source of the main form text box to:
=[SFrmInvoiceDetails].[Form]![TotalSalesAmount]
Probably won't make a difference, but is more explicit.

3. The Nz() is useful for converting Nulls, but won't solve the #Error.

4. If the subform is set up such that no new records can be entered (e.g. if
its AllowAdditions property is set to No, or it is based on a read-only
query), the subform area will display completely blank. In this case,
attempting to read the non-existent text box in the subform yields "#Error".

You can fix this by making changes so the subform can accept new records.
Alternatively, you can use an Immediate If expression to test for that case:
=IIf([SFrmInvoiceDetails].[Form].RecordsetClone.RecordCount > 0,
Nz([SFrmInvoiceDetails].[Form]![TotalSalesAmount],0), 0)

5. If that does not solve the issue, check for any other calculated controls
that could be interferring. Once one control cannot be calculated, Access
can give up on trying the others.

6. Make sure you have the latest service pack for your version of Access
from support.microsoft.com. We have seen cases with runtime Access where a
machine that had both the runtime and full version of Access intermittently
showed #Error until it was brought up to the latest service pack.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Charlene" <cp***@earthlink.net> wrote in message
news:pk*****************@newsread1.news.atl.earthl ink.net...
I have an Invoice/Invoice Details form/subform. In the page footer of the
Invoice Details subform I have a textbox with the control source set to
=Sum([SalesAmount]). I then pull this value into the main form with a textbox whose control source is =[SFrmInvoiceDetails]![TotalSalesAmount]. This works fine when there are one or more line items in Invoice Details but on a new
invoice before any invoice details are entered, the textbox on the main form shows #Error. I would like it to show $0.00. I have tried the NZ function in different places without success; I keep getting #Error no matter what I try when there are no records in the subform. What is the correct way to set this up so that the main form shows $0.00 when there are no records in the subform and then the total of the line items after one or more line items are entered?

Thanks for all help!

Charlene

Nov 12 '05 #2

"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:40**********************@freenews.iinet.net.a u...
Comments: This message did not originate from the Sender address above.
It was remailed automatically by anonymizing remailer software.


Please ignore this posting.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 12 '05 #3
"Tony Toews" <to**********@yahoo.com> wrote

Another impersonation. Tony doesn't post via the semi-anonymous teranews
news server nor use a return address that is derogatory to him. Don P Mellon
is known to use both.
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Sabine Oebbecke | last post by:
Hi Experts! I have several forms and reports where controls get their values with 'Forms!MainForm!Control' or 'Forms!MainForm!Subform!Control' resp 'Forms!MainForm!Subform.Form!Control' which...
0
by: P Mitchell | last post by:
Hello I would like someone to be able to help with the updating of data in a lookup list in a subform. In short, is their a VB instruction that is the equivalent of performing the action of...
1
by: planetthoughtful | last post by:
Hi All, I have a mainform with a subform in which I show some task summary data. On the mainform I have a number of unbound controls that reflect values relevant to each task in the subform....
4
by: Macbane | last post by:
Hi, I have a 'main' form called frmIssues which has a subform control (named linkIssuesDrug) containing the subform sfrmLink_Issues_Drugs. A control button on the main form opens a pop-up form...
2
by: John | last post by:
I have a mainform with a subform. The subform is sorted on a specific field and when I just open the subform, the sorting is OK. However, when I open the mainform, the sorting in the subform is...
3
by: xian2 | last post by:
Hi All, I am trying to create a subtotal text box much like the one in the orders form of the northwind database where you have a subtotal text box in the footer of the subform and then have that...
18
by: Robert Jacobs | last post by:
Please advise... I currently have a Mainform (Customers) and a Subform (Service Requests) with a one to many relationship (one customer, many service requests) with a CustomerID that is unique...
5
by: JHite | last post by:
I’m using Access 2003 on Windows XP. I have a Mainform (Staff Entry) which displays an unbound combo box named ChooseStaff. The Row Source for this combo box is a SELECT of the UserIDs and Staffer...
24
by: bkberg05 | last post by:
Hi - I have a form called mainForm that has a subform called subForm. The subform has a numeric field called subCost. There are many subForm records for every mainForm record. On the main form,...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.