Solved

Formula: show total only if certain company is choosen

Posted on 2011-09-21
5
331 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
ID: 36575063
<<<<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 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 200 total points
ID: 36575074
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
ID: 36575163
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
ID: 36575598
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)
ID: 36575623
wgraphics,

Glad to help.  That is why we are here, to help others learn.
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

713 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