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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Textbox based on IIF 1

Status
Not open for further replies.

jazminecat23

Programmer
Mar 16, 2007
103
US
I have a report based on the following query:
Code:
SELECT Tbl_suppl_main.reqType, Tbl_suppl_main.supplID, Rights.[Unit ID], Rights.Department, Rights.Division, Tbl_suppl_main.Fund, Tbl_suppl_main.Attachment, Tbl_suppl_main.CostCntr, Tbl_suppl_main.Originator, Tbl_suppl_main.Name_Request, Tbl_suppl_main.Data_Entry_Date, Tbl_suppl_main.Descrip_Requested, Tbl_suppl_main.Objectives, Tbl_suppl_main.Ongoing, Tbl_suppl_main.Personnel, Tbl_suppl_main.Priority, Tbl_suppl_Obj.Object_Code, Tbl_Obj_Codes.Object_Descr, Tbl_suppl_Obj.Amount, Tbl_ASR_ExpType.Exp_Type, Tbl_ASR_status.Status, Tbl_suppl_main.Problem, Tbl_suppl_main.Customer, Tbl_suppl_main.Need, Tbl_suppl_main.CustService, Tbl_suppl_main.Advantages, Tbl_suppl_main.Outcomes, Tbl_suppl_main.OutcomeDate, Tbl_suppl_main.Measure, Tbl_suppl_main.Impacts, Tbl_suppl_main.WhoResponsible, Tbl_suppl_main.WhoMeasures, Tbl_suppl_main.OtherKeyPlayers, Tbl_suppl_main.PotentialFunding, Tbl_suppl_main.Flag_Space, Tbl_suppl_main.Addl_FTE, Tbl_suppl_Obj.Approved_Amt, Tbl_suppl_Obj.Final_Amt, Tbl_suppl_main.yearno, tbl_supplyearno.Year, Tbl_suppl_main.Exec_Approv_Status, Tbl_suppl_Obj.Sub_Obj_Code
FROM (((Tbl_suppl_Obj RIGHT JOIN ((Tbl_suppl_main LEFT JOIN Tbl_ASR_ExpType ON Tbl_suppl_main.Ongoing = Tbl_ASR_ExpType.Exp_Type_Code) INNER JOIN Rights ON Tbl_suppl_main.UnitID = Rights.[Unit ID]) ON Tbl_suppl_Obj.supplID = Tbl_suppl_main.supplID) INNER JOIN Tbl_ASR_status ON Tbl_suppl_main.Exec_Approv_Status = Tbl_ASR_status.Status_Code) LEFT JOIN Tbl_Obj_Codes ON Tbl_suppl_Obj.Object_Code = Tbl_Obj_Codes.Object_Code) INNER JOIN tbl_supplyearno ON Tbl_suppl_main.yearno = tbl_supplyearno.Yearno
WHERE (((Tbl_suppl_main.Exec_Approv_Status)=1))
ORDER BY Rights.Division
WITH OWNERACCESS OPTION;

I want to use an IIF function in my textbox, to look at the Tbl_suppl_Obj.Object_Code. If that data has a decimal in it, as in xxxx.xxx, then I want it to only show the Object_Code. If it doesn't have that, I want the text box to show the Object_Code, a decimal, and then the Sub_Obj_Code.

I have used this code in another report as follows:

Code:
=IIf([Object_Code] Like "*.*",[Object_Code],[Object_Code] & "."+[Sub_Obj_Code])

this works perfectly.

But i can't get it to work on this new report. It gives me an #error every time. I can get it to show either the Object_Code or the Sub_Obj_Code, but not to look at it and do the above logic.

Can anyone see what I"m missing here? Thanks!
 
Did you make sure the name of the text box is not the name of a field in your report's record source?

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Thanks Duane! Something so obvious, yet I completely missed it. Have a star!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top