473,668 Members | 2,330 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calculate totals from nested forms

Hi,
I have 3 nested forms and want to calculate a total on the first
subform (as the form loads)by adding 2 fields from that form
[deposit]+[rental] to a field on the second subform.
Second subform is [transactional subform] and control is Sumpd.
I use this

=[transactiontbl subform].Form!Sumpd+[deppd]+[rentpd]

which works well as long as the transactiontbl subform has records in
it. Problem is this subform will often be empty. I then get error as a
result in my calculated control. Have tried using Iif statements eg

=IIf(Me![transactiontbl
subform].Form.RecordCou nt=0,[deppd]+[rentpd],[transactiontbl
subform].Form!Sumpd+[deppd]+[rentpd])

but as a newbie am surely writing something wrong!
All forms are nested with master/child fields linked. Table
relationships also look OK.
Any help much appreciated.

Nov 13 '05 #1
1 1766
Try - Nz([transactiontbl subform].Form!Sumpd) + Nz(deppd) + Nz(rentpd)
I'm not sure it will work, but give it a go. Nz is used to convert Nulls to
Zeros.
Incidentally you don't need square brackets [] round field name or table
names PROVIDING there are no spaces in them. Makes expressions a little
simpler, but suggest you never use spaces in field name e.g. use
TransactionTblS ubform

HTH

Phil

<on***********@ hotmail.com> wrote in message
news:11******** *************@g 14g2000cwa.goog legroups.com...
Hi,
I have 3 nested forms and want to calculate a total on the first
subform (as the form loads)by adding 2 fields from that form
[deposit]+[rental] to a field on the second subform.
Second subform is [transactional subform] and control is Sumpd.
I use this

=[transactiontbl subform].Form!Sumpd+[deppd]+[rentpd]

which works well as long as the transactiontbl subform has records in
it. Problem is this subform will often be empty. I then get error as a
result in my calculated control. Have tried using Iif statements eg

=IIf(Me![transactiontbl
subform].Form.RecordCou nt=0,[deppd]+[rentpd],[transactiontbl
subform].Form!Sumpd+[deppd]+[rentpd])

but as a newbie am surely writing something wrong!
All forms are nested with master/child fields linked. Table
relationships also look OK.
Any help much appreciated.

Nov 13 '05 #2

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

Similar topics

53
5694
by: Cardman | last post by:
Greetings, I am trying to solve a problem that has been inflicting my self created Order Forms for a long time, where the problem is that as I cannot reproduce this error myself, then it is difficult to know what is going on. One of these Order Forms you can see here... http://www.cardman.co.uk/orderform.php3
4
8670
by: Sven Seljom | last post by:
I want to take the value from one form-field, deduct the VAT and return the value in another form-field. I have made a Public Function for this and attached it to the text-box. Can anybody help me with the correct syntax? Here's what I got so far: Public Function specify_VAT() Dim vat vat = "/1.24" End Function
1
1974
by: Ladislau S. | last post by:
Dear reader, I am an occasional user of MS Access 2000 running on Windows 98. My hobby is ship model building so I made a database for things that I want to buy. After two strokes I bin unable to remember or find how to calculate the sum of the prices of a column. I made query to calculate the price of itch item (I have some multiple items). Whit this query I made a nice report, bat the best, how match is the price of my wish list I do...
5
5328
by: ~~~ .NET Ed ~~~ | last post by:
Hi, As you all know when an ASP.NET web form is created that will include web controls and such, it contains a FORM that that identifies the web form and its containing controls. Well, I have a web form who has several other (user & custom) controls, these are enclosed within the standard FORM tag. Additionally *some* of these user controls are actually forms as well. This results into nested Forms.
4
6366
by: Rich_C | last post by:
I'm sure this is very simple, but I have very little experience with javascript -- and what I do know isn't helping me here. I have a simple form where users can enter a quantity (qty) and cost (cost). Users can dynamically add rows to the table so I don't know how many rows might need to be calculated. I need to calculate the total (qty * cost) and put that number in a table cell (or read only input box). I also need to sum the...
2
1765
by: Ron | last post by:
Hi All, I've got a main form (frmMain) with 5 subforms on it. All subforms are linked to different hidden controls on frmMain. The purpose of this form is to record payments by 'source' (batches) so frmMain's source is a query on BatchPaymentID. New 'source' for payment, new BatchPaymentID. 1st subform (sfrmOne) is a client list of just the client's that would have that source of payment. Next subform (sfrmTwo) is a list of charges...
6
4879
by: Stuart Shay | last post by:
Hello All: I have a array which contains the totals for each month and from this array I want to get a running total for each month decimal month = new decimal; month = 254; (Jan) month = 78; (Feb) month = 34; (Mar) ect ...
0
4634
by: SuzK | last post by:
I am trying to calculate in VBA in Access 2002 a moving average and update a table with the calculations. Fields in my WeeklyData table are Week Ending (date) ItemNbr (double) Sales Dollars (double) Sales Units (double) Promo (Text) -- is null or "X" AvgWklyDollars (double) AvgWklyUnits (double) I have a vba module which I thought would work, but it doesn't. I think the problem is an embedded SQL Totals Top 8 query, which doesn't...
5
2327
by: colin spalding | last post by:
How do I design a totals query that instead of the following result YearOfAcc PremiumGBP 2004 9,142,306.95 2004 1,481,153.21 2005 11,981,987.85 2006 20,653,195.20 2006 -521,140.08 2006 -455,788.20 2006 -212,507.35
0
8374
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,...
1
8575
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
8653
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
7398
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...
1
6206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4202
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2018
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1783
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.