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

Resizing a text field on a Report

Status
Not open for further replies.

mybers

IS-IT--Management
Mar 24, 2004
62
PH
Hello Guys,

Is it possible to resize a textbox if the length of the text becomes higher than 20 characters making it smaller like from 24px to 22px?

Ofcourse, the succeding pages will not be affected as long the length of the text remains below 20.

Please save me from this agony of confusion.!

mybers
 
You can use code in the On Format event of the section containing the control:
Select Case Len(Me.txtBox)
Case is < 20
Me.txtBox.FontSize = 24
Case Else
Me.txtBox.FontSize = 22
End Select
You can modify the code to meet your needs.


Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Hello dhookom


It gives me an error msg "compile error invalid qualifier'

How do I get go around this?

 
You tell us what line is causing the error. Also paste your exact code into a reply so we can see what you can see.


Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
have you considered setting the textbox and Detail's Can Grow and Can Shrink properties to Yes?

PaulF
 
Hello guys,,

So far this is what I wrote:
Code:
[highlight yellow]Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)[/highlight]
Select Case Len(Me.name)
   Case Is < 20
      Me.[highlight blue][COLOR=white]name.[/color][/highlight]fontsize = 22
   Case Else
      Me.name.fontsize = 20
End Select

Then it gives me a pop-up message

Compile Error:

Invalid qualifier

Any adjustments?

Thanks

 
Name is a poor name for objects that all have a name property. I expect Access believes you are referring to the name property of the report. You could change the name of the text box to "txtName".
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Select Case Len(Me.txtname)
   Case Is < 20
      Me.txtname.fontsize = 22
   Case Else
      Me.txtname.fontsize = 20
End Select
Find a good naming convention and stick to it. I use something similar to
Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Thanks Dhookim

When things get rough, brains screws up!

Thanks.....got it now....I should be more familiar with naming conventions


Regards,

mybers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top