Solved

Access - SubForm based on Query - Sum if query Is Null

Posted on 2013-01-31
2
513 Views
Last Modified: 2013-02-02
Hello all
I have a Form.  On that Form I Have a textbox where I display an amount from a formula that pulls totals from 3 Subforms.  

The 3 Subforms Each have a textbox in the header where I Sum([TrAmt]) .  Each Subform is based upon a different query.

Everything works right until in that Main Form textbox on the Main Form UNLESS one of the SubForm's queries is Null.  


I have tried nz(Sum([TrAmt],0) but if the Subform's query is null that textbox field just displays as blank.   Then the Main Form's textbox goes into an #Error state.

Any Suggestion?
0
Comment
Question by:wlwebb
2 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
ID: 38843028
NZ() won't have any effect if the value does not exist.

Try this approach...
Put a hidden textbox on the subform, and set its controlsource to:
 =Count(somefieldwhichwouldneverbenull)
Say this is called Kount

Then in the main form you can do...

=IIf([subctrl1].[Form]![Kount]>0,[subctrl1].[Form]![thesumcontrol],0)
0
 

Author Closing Comment

by:wlwebb
ID: 38847960
Thanks Peter that worked with some modification
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now