Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / March 2007

Tip: Looking for answers? Try searching our database.

Adding subform totals if one subform is Null

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JJF - 14 Mar 2007 16:25 GMT
I have a main form (supermarket order) with three subforms (meat, groceries,
produce). Each subform multiplies [quanty] * [price] and sums it's catagory.
The main form totals the three subforms.  All is fine until the customer
doesn't order from all three catagories. I get #ERROR. Any help?
Allen Browne - 14 Mar 2007 16:50 GMT
That should work unless the subform's Detail section goes completely blank
when there are no records.

IF that happens, you will need to test whether it has records, so instead
of:
   =[Sub1].[Form].[txtTotal]
you need:
   =IIf([Sub1].[Form].[RecordsetClone].[RecordCount] = 0, 0,
Nz([Sub1].[Form],0))

Unfortunately, that expression fails in Access 2007. Post back if you are
using the new version.

For an explanation of why the form goes blank, see:
   http://allenbrowne.com/casu-20.html

Signature

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.

>I have a main form (supermarket order) with three subforms (meat,
>groceries,
> produce). Each subform multiplies [quanty] * [price] and sums it's
> catagory.
> The main form totals the three subforms.  All is fine until the customer
> doesn't order from all three catagories. I get #ERROR. Any help?
JJF - 14 Mar 2007 17:40 GMT
In your =IIf statement what is [RecordsetClone] and [RecordCount]. I'm in
access 2003

> That should work unless the subform's Detail section goes completely blank
> when there are no records.
[quoted text clipped - 18 lines]
> > The main form totals the three subforms.  All is fine until the customer
> > doesn't order from all three catagories. I get #ERROR. Any help?
JJF - 14 Mar 2007 18:13 GMT
Thanks Allen. It worked.

> In your =IIf statement what is [RecordsetClone] and [RecordCount]. I'm in
> access 2003
[quoted text clipped - 21 lines]
> > > The main form totals the three subforms.  All is fine until the customer
> > > doesn't order from all three catagories. I get #ERROR. Any help?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.