Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2013-01-31
2
Medium Priority
?
531 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
[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
2 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 2000 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’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

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

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…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

636 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