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

Shrinking Text Boxes

Status
Not open for further replies.

hnoon

Technical User
Jul 15, 2003
3
US
What criteria does MS Access use to Shrink a text box? I want to Shrink a text box if a certain condition is met, else go ahead and show it.

I would imagine it should work with something like this in the Text Box Control Source:
=IIf(<Shrink Condition Goes Here>,&quot;&quot;,[MyDataSource])

I tried using Null instead of the empty string too; didn't work either way. A good way would be to call a method like MyTextBox.Shrink() but I don't know if anything like that exists.

Any suggestions?

Thanks,
H.
 
All your IIF is going to do is if the textbox condition is true return an empty string otherwise return the value of the field. No shrinking indicated.

Just what do you mean by shrinking. Is that horizontal or vertical. Why not just enable/disable or make visible or invisible. We can change the width size of the control in code if you want.

Just describe in regular terms what you want the textbox to do without using Shrink and we will see what we can do.

Bob Scriver
Want the best answers? See FAQ181-2886
Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
I'm not sure what you mean by horizontal/vertical. Let me try and explain what I meant a bit better.

Say I want to place an address somewhere in my report. The textboxes present are going to be (arranged one on top of the other):
Name
Address
City
State

There are other elements present in the report below these ones. I want to hide the State if it matches say Michigan but have the space between this address and anything below be consistent.

If I enable the &quot;Can Shrink&quot; property on the State TextBox, it will hide properly only when a recordset has no State value.

H.
 
I feel really silly. Turns out I had a vertical line that was interfering with the formatting. turns out the
=IIf([State]=&quot;Michigan&quot;,&quot;&quot;,[State])
or the
=IIf([State]=&quot;Michigan&quot;,Null,[MyDataSource])

work just as well. As long as the &quot;Can Shrink&quot; property for the TextBox is set to yes.

Thanks anyway,
H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top