Solved

Formula: show total only if certain company is choosen

Posted on 2011-09-21
5
290 Views
Last Modified: 2012-06-21
Hi-
Access 2000
Preface: User opens a form, chooses company, enters date range and a report appears. This formula is part of the report:

=(0.25)*Sum(IIf([PrintLessCode]="P2S",1,0))+Sum(IIf([PrintLessCode]="P2U",1,0))+Sum(IIf([PrintLessCode]="S2S",1,0))

I only want this formula to show up on the report only if a certain company is chosen. We have 20+ companies the user can choose from so to make it simpler let's say we only have the following company names:

Acme1
Acme2
Acme3

If the user chooses Acme 1, then show the formula on the report. If they choose Acme2 or Acme3 then don't have anything show up on report.

When I try the formula below, I get "expression contains invalid syntax, you may have entered operand w/o operator.

=IIf([CustomerName]=”Acme1”,(0.25)*Sum(IIf([PrintLessCode]="P2S",1,0))+Sum(IIf([PrintLessCode]="P2U",1,0))+Sum(IIf([PrintLessCode]="S2S",1,0)),””)

What seems like it should  be easy is giving me trouble- thanks!!!
0
Comment
Question by:wgraphics
5 Comments
 
LVL 19

Expert Comment

by:Eric Sherman
Comment Utility
<<<<I only want this formula to show up on the report .....>>>>>

Can you explain a bit further.  I'm not sure what you mean by show up on the report.

ET
0
 
LVL 119

Assisted Solution

by:Rey Obrero
Rey Obrero earned 200 total points
Comment Utility
why not just hide/unhide the textbox if a company was chosen or not

me.txtboxName.visible= [CustomerName] & ""<>""
0
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 300 total points
Comment Utility
I agree with capricorn1,

Use the Format event of the section of the report where the control is where that calculation is performed to hide it.  Probably the detail section, so it would look like:

Private Sub Detail_Format

    me.txtboxName.visible = ([CustomerName] = "Acme1")

End If
0
 

Author Closing Comment

by:wgraphics
Comment Utility
Thank you so much. It took me awhile but using your instructions I was able to figure it out. I do not have any formal training so I truly appreciate your patience- often times what I think should be a simple task ends up having to be done in an area I am not familiar with!
Have a great day!
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
Comment Utility
wgraphics,

Glad to help.  That is why we are here, to help others learn.
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…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

771 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

13 Experts available now in Live!

Get 1:1 Help Now