Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Hiding or displaying labels in a report

Author  Topic 

kaus
Posting Yak Master

179 Posts

Posted - 2003-01-14 : 11:50:41
I've been trying to set a label in a report as 'Not Specified' if a text box that is attached to a column in a query has no data. I havent had any luck -- I've tried conditional statements on the text box and setting the label. If anybody has any ideas or experience with this it would be much appreciated.

Thanks

Pete

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-01-14 : 12:16:10
When you say no data -- do you mean the field is null?

If so, there are two steps:

1. First, make sure you change the name of the textbox object on the report if it is the same as the field name. if you drag and drop from the field list to a report, the textbox has the same name. Change it to 'txtFieldname' or something similiar if this is the case. The problem is, if the textbox is named 'field' there is a column in the data called 'field', you cannot change the controlsource of the textbox without getting errors.

2. Then, change the controlsource of the textbox from

field

to

=IIF(Field is null,'Other',Field)


- Jeff
Go to Top of Page

kaus
Posting Yak Master

179 Posts

Posted - 2003-01-14 : 13:02:11
I've tried this in the control source for the textbox:
the textbox name is txtcell, the field name is cell --
Iif([cell] is null, 'Not Specified', [cell])

I've tried with brackets and without brackets but always get Name? in the report -- doesnt recognize the name -- do I need to set it using VB in the open report event ??

Thanks

Pete

Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-01-14 : 13:19:54
Did you try putting an "=" before the formula? That usually does the trick in these cases, in addition to changing the name of the text box.

- Jeff
Go to Top of Page

kaus
Posting Yak Master

179 Posts

Posted - 2003-01-14 : 13:30:02
quote:

Did you try putting an "=" before the formula? That usually does the trick in these cases, in addition to changing the name of the text box.

- Jeff



Thanks -- that was it exactly !

Pete

Go to Top of Page
   

- Advertisement -