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 / General 2 / January 2008

Tip: Looking for answers? Try searching our database.

Sum an IIF

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SAC - 14 Jan 2008 19:35 GMT
I have a control with a data source as follows:

=(IIf([chktaxable]=-1,[txtPriceNet],0)

I'd trying to set up another control that would sum this as follows:

=Sum(IIf([chktaxable]=-1,[txtPriceNet],0))

but I get an error.

Any ideas on what I can do?

Thanks.
Jeanette Cunningham - 14 Jan 2008 19:45 GMT
SAC,
try this:

=IIf([chktaxable]=-1,Sum([txtPriceNet]),0)

Jeanette Cunningham

>I have a control with a data source as follows:
>
[quoted text clipped - 9 lines]
>
> Thanks.
SAC - 14 Jan 2008 21:48 GMT
Thanks!!
> SAC,
> try this:
[quoted text clipped - 16 lines]
>>
>> Thanks.
SAC - 24 Jan 2008 01:04 GMT
Thanks!!
> SAC,
> try this:
[quoted text clipped - 16 lines]
>>
>> Thanks.
John W. Vinson - 15 Jan 2008 16:39 GMT
>I have a control with a data source as follows:
>
[quoted text clipped - 3 lines]
>
>=Sum(IIf([chktaxable]=-1,[txtPriceNet],0))

Not sure why that shouldn't work... but you can be sneaky and not use any IIF
at all!

Abs(Sum([chktaxable]*[txtPriceNet]))

will multiply the value of txtPriceNet by -1 if the item is taxable and by 0
if it isn't.

If txtPriceNet is a *form textbox* though, you can't sum it; you can only sum
field values in the form's recordsource query/table. You may need to do this
based on the actual table fieldname (PriceNet?) instead of the form control.

            John W. Vinson [MVP]
 
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.