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

Hiding A Value

Status
Not open for further replies.

jbento

Technical User
Jul 20, 2001
573
US
All,
I have a report that has a field that holds several values (drop-down menu). One of those values is a ".". I am trying to write code to hide the "." when the report comes up. I only want the other values to show. The code I tried is the following, but it doesn't work:

If field.Text = "." Then
field.Text = ""

What am I doing wrong? Can someone please help me, and as always your help is GREATLY appreciated:):):)
 
I forgot to mention that I put this code on the "On Open" function of the report.
 
Instead of using the field name for the Control source use the following function:

=IIF(field.text = ".", " ", field.text)

Now I am using your example names here. You have to change this to your reports object names. But, you are analyzing the value of the object and returning a space if the period is about to be displayed. Otherwise, the value is displayed.

Bob Scriver
 
scriverb,
I tried your suggestion, but it didn't work. Once I typed in the function in the Control Source field, it corrected it into the following: =IIF([field.text] = ".", " ", ([field.text]). It put the brackets in, and I did change the "field.text" to my real field name:).

Once I brought up the report after puting the function in, it brought up a message box that asked for me to put data in for the field.text, and I just chose cancel, and the report came up with the field having "name?" in the field. What do I do now?
 
Create a report control with the table field as the control source. Make it invisible by setting the visible property to false. Change the name of the control to a descriptive name like "ctlTextData1". You can delete this controls label and squeeze the size down to just a sliver if you want. Place it anyplace on the detail section line and out of the way as it won't be displayed. Now in the control that we were working with before put the following:

=IIF(me![ctlTextData1]= ".", " ", me![ctlTextData1])

This will now evaluate the invisible control and either return a space or the actual value to display in this control. The "." will be replaced with a blank space for display.

Bob Scriver


 
I found the answer for this problem, and it is as follows:

Sometimes it is easier to create an Unbound Text Box and use the original bound text box in the statement. Then you can go to Properties, Format in the original text box and enter No in Visible.
If the original text box is [BoardRationale], in the Unbound Text Box, Properties,Data, Control Source,try this:

=IIF([BoardRationale]="Is This Expedited?", "Null", [BoardRationale])

That worked for me. Thanks to all for your assistance. This site is the GREATEST!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top