473,662 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 =[SFrmInvoiceDeta ils]![TotalSalesAmoun t]. 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 5873
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:
=[SFrmInvoiceDeta ils].[Form]![TotalSalesAmoun t]
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([SFrmInvoiceDeta ils].[Form].RecordsetClone .RecordCount > 0,
Nz([SFrmInvoiceDeta ils].[Form]![TotalSalesAmoun t],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.microso ft.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***@earthlin k.net> wrote in message
news:pk******** *********@newsr ead1.news.atl.e arthlink.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 =[SFrmInvoiceDeta ils]![TotalSalesAmoun t]. 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*********@Se eSig.Invalid> wrote in message
news:40******** **************@ freenews.iinet. net.au...
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**********@y ahoo.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
2406
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 works without any problem in Acc97, 2000 and 2002, but now in Access 2003 there seem to be a problem with this. A user is working with my app, and he uses an Access 2002 MDE in an Access 2003 environment.
0
2095
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 going to the menu and selecting Records and then Refresh? or To explain, based on a three table system where cars participate in rallies,
1
3064
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. The unbound controls are populated in the subform's OnCurrent even from a number of different tables related to the records in tbl_tasks, which is the recordset displayed in the subform.
4
8825
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 which allows me to edit the record in the subform. What I want to happen is for subform with the new edits to be updated on the main form when I close the popup. I'm sure this is a very small bit of code in the the 'On close' event for the popup...
2
1730
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 gone. The subform has no data link to the mainform. How can I persist my sorting in the subform? Thanks in advance, john
3
2226
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 displayed as a text box in the main form. However, I am having difficulties in doing this and keep getting #Error or #Name? displayed in it. Any Ideas would be much appreciated. Background info: Form = Tours
18
3601
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 for each customer and is autofilled on the subform. Subform contains field called TicketID (which there could be multiple instances of and is not referenced on the mainform at all). I want to be able to type in a TicketID and have the mainform...
5
2619
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 Names from a table (Staffers) which contains staffers’ names and other info. When the user actually selects a Staffer Name from the dropdown combo box, the VBA routines for the combo box’s On Enter and After Update events take care of finding and...
24
6469
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, there is a field called mainCost. Whenever someone makes a change to the subCost field, I want to populate the mainCost field with the sum of the subCost values. The mainForm and the subForm are joined by mainID = subID. Here is my lame...
0
8432
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8344
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8764
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8546
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7367
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5654
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1752
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.