Solved

How to base the sum of a control on the state of another control (checkbox)

Posted on 2015-02-12
5
75 Views
Last Modified: 2015-02-12
I have a subform for which I am summing one of the controls, using the simple expression =Sum([LineTotal])

I would like that sum to only include the records for which a checkbox control is "true", but I'm not certain how to modify my expression to accomplish this. (see attachment)

Thank you in advance.clip.jpg
0
Comment
Question by:Shooter54
[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
  • 3
  • 2
5 Comments
 
LVL 29

Accepted Solution

by:
IrogSinta earned 500 total points
ID: 40606545
=Sum(IIF([CheckBoxFieldName],[LineTotal],0))

Ron
0
 

Author Comment

by:Shooter54
ID: 40606578
Perfect! Thank you very much.
0
 

Author Comment

by:Shooter54
ID: 40606822
I've requested that this question be closed as follows:

Accepted answer: 0 points for Shooter54's comment #a40606578

for the following reason:

Simple and concise solution to what to me was a difficult problem.
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 40606608
Looks like you inadvertently selected your own comment as the answer.  I suggest you click on Request Attention at the top (right after your question) to someone fix this.
0
 

Author Comment

by:Shooter54
ID: 40606823
I inadvertently accepted my own response as the solution. (sorry, new user) IrogSinta, ID 40606608 provided me the solution. Please resolve.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

740 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