# Formula: show total only if certain company is choosen

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!!!
###### Who is Participating?

Commented:
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

Accountant/DeveloperCommented:
<<<<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

Commented:
why not just hide/unhide the textbox if a company was chosen or not

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

Author Commented:
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

Commented:
wgraphics,

Glad to help.  That is why we are here, to help others learn.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.