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

can an iif statement be used in a textbox in a report

Status
Not open for further replies.

Juddy58

Technical User
Jan 21, 2003
176
AU
Hello i need the syntax for an iif statement for a textbox in a report.
Sometimes the control source for the textbox doesn't exist, and the report wont open due to an error.
i have tried using an iif statement for the textbox so if the controlsource "A" doesnt exist a blank field will be used:
iif(isError([A], "",[A])
so if there is an error the control source will be ""
This method doesn't seem to be working just wondering if anyone has advise as to why.
Thanks!
 
Problem is that the iif statement itself relies on the existance of the [A] control - its testing its value.

The question is: why does the control not exist sometimes. Would'nt it be better for you to condition your report's recordsource so that the control source for that control always existed;

To get the best advise on this post, you probably need to provide more information on what you're doing.

Another approach might be to remove the control source from the control on the report's OnOpen event; eg. if the control is called [A] and it receives a control source of the same name, then the event could contain the following code:

me!A = "=null"

You may need to use error handling or some other code to see whether the reports record source contains an [A] field; also may need to put this code on the Activate as opposed to the OnOpen event; I dont remember; give it a go.

Hope this helps; sorry if the advice is a bit fragmented, but its been a long day ........... Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
(dont cut corners or you'll go round in circles)
 
thanks for the help. im trying to put a cross tab query into a report, and it doesn't show any changes in the headings because they are permanent in the report. I have started using vb coding in the on load event for the report it seems to be going ok (so far!)
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top