Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suming 2 Text Fields If One is a formula?

Status
Not open for further replies.

djmousie

Technical User
Oct 10, 2001
164
US
I have two (2) Text Fields on my report, for instance,

Text1:

Control Source: IIF([A]=0,B)

Text2:=Sum[Text1]

When I run the report it cannot find the Text1 field. Is it because im referencing a text field that contains a formula? Any help would be great.

Thanks in advance.
 
You are referring to "text boxes" not "text fields". You can't sum controls. You must sum the expression from the control. Also the []s should be ()s. Try:
=Sum(IIf([A]=0,B)
However this expression is confusing since IIf() should have three parts [Condition], [TruePart], and [FalsePart]. Your IIf() has only two.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Actually my first expression does have those 3 parts, I was quickly just trying to show you what I am doing.

When I try the above method, when I click on my report to see the print preview, and I go to the last page, which contains that second field box, the report automatically closes and goes back to the design mode. Looks as if it doesnt like that sum of the expression. Any thoughts?
 
I figured out. Rather than creating the expression on the actual report, I created another select query to create that field. From there I pulled in that new query as my control source for my report, this way i dont have to hard code a text box.

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top