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

cangrow control property 1

Status
Not open for further replies.

atray04

Programmer
Dec 29, 2003
112
US
Does anyone know about the can grow property? I am trying to hide a textbox when it is null. I do not have anything else on the line, but it still is not working. Am I missing something?

 
surely you want the canShrink property?

or you could use code, and put in .visible = false in a if statement...
 
Hi! atray04, what you can do is, make the txt-box really samll and most importantly, bind it with some data (like =Date() , =Time() or any of your custom data), then: go to the properties of the text-box (right-click to propertieS) and write "YES" in front of the text-box's Can Grow and Can Shrink properties.

AshiJ
 
oops i meant the canshrink property. The visible property does not work, because it only hides it and does not shrink the line.

The CanShrink property is not working though, even after I got rid of everything in the line but the control.
 
hey atray, did u check the reply above? tell me if thatworks for you!!

AshiJ
 
It does work, but when I added my labels back to the line it did not work. Can I not have labels on the line? And can I have only one control per line? Ill write an example out in a second.
 
you can have as many things as you want on a line...

however your label doesn't dissapear when there's nothing because it's not tied in with your textbox...

you could try doing this programically, by setting the height of the label to 0cm if the text box isnull
 
that sounds like a possibility. Would I put it in the print event for details? And would it do this sellectively for each report?
 
Everything works perfectly except that the labels seem to disappear for every record.
 
ah, so you have 1 label for each record...

put the code in the onOpen event of your report...
and then test the context of the textbox, not the result of the query...

e.g.
if isnull(tbxName.value) then
invisible
endif
 
That seemed like it would work. I did exactly what you said, but I received the error: Run-time error '2427':
You entered an expression thats has no value.
The expression may refer to an object that has no value, such as a form, a report, or a label control.
 
do you know why I might be receiving this error?

-ATray
 
Hey ATray, correct me if I'm wrong, I guess what ur trying to say is: you have a text box and label associated wit hthe text box right? and you want the line to dissapear if the text-box is null. If you have the same text -box in several reports (with the same value), you might want to do this:
put both the text box and the label in a seperate report,say: TextReport(make New in Design View).
Now, go back to your Main Report(Parent) and put the TextReport there,
-->the horizontal length of this subreport(TextReport) should be as long as the combined length of textbox/label inside it.
-->the vertical length of subreport (TextReport) should be a fraction of a line.
--> in the property of the subreport (TextReport)CanShrink and CanGrow property should be set to "Yes".

tell me if this is what u wanted..and iftheres a problem, pleas ecan you give me a basic description of the controls you want to play around with.

GoodLuck![thumbsup2]

AshiJ
 
Ok, I put both my text box and label in a separate report. I wasn't exactly sure how to put my report in my main report so I created a textbox and put the control source pointing to the report. Please correct me if that was wrong. So when I view my report I get a error#.
 
Are you trying to shrink the whole row, and it's only this label and control on it?

If the text control is named txtMyText, try the following:

In the original report, remove the label, and make txtMyText very small (height). Add another text conttrol and remove it's label. Set the controlsource of the new textcontrol to:

[tt]="Your label text: " + [txtMyText][/tt]

Make it tiny, make the section tiny, both having the can grow properities set to yes.

Roy-Vidar
 
Thank this will should fix my problem. How when I do exactly what you say my text box that has the control source pointing to: ="Your label text: " + [txtMyText] shows up as #ERROR? Ill try to messs around with it some more and see if I can fix it.

-ATray
 
i think I might be getting the #error becuase my other textbox control source points to a integer. How would I fix this?
 
Think you are correct.

I've been fortunate enough to be able to use 0 as default value on numerics, so I haven't encountered this before. Interesting! Must be more elgant ways, but I made something like this work:

[tt]=iif(isnull([txtMyText]),Null,"Your label text: " & [txtMyText])[/tt]

Roy-Vidar
 
Thank you that worked perfectly. Well it looks like I have all of my problems finally fixed.

-ATray
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top