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

text wrapping

Status
Not open for further replies.

Hargreavesk

Technical User
Jul 18, 2001
97
GB
Hi,

I have a function which fills my text boxes with asterisks based on the amount of text I put in them. When I put in the following "JoeBloggs" it then fills the text box like this:

JoeBloggs*****************************
**************************************

However, when I put in the following "Joe Bloggs" it then fills the text box like this:

Joe
Bloggs********************************

The text seems to be wrapping when it finds a space in the field. Can anyone explain why this is happening and what I need to do to stop it?

My query is using Len to calculate the length of the text before adding the asterisks - could this have something to do with it?

Any help would be appreciated.

Kate
 
This will happen as it is standard with text wrapping. If you have a long line of characters with no spaces, it will fill each line before wrapping. If you have any spaces, the wrapping happens at the space before the word that would go past the end of the text box. In your case it is before the Bloggs.

I don't think there is any way you can turn this off (I am using Access 97), unsless anyone else kneows of a way. Have fun! :eek:)

Alex Middleton
 
If you can use a fixed width font, possibly you could determine exactly how many characters would be in a line, and throw in a space at the point where you would want the line to break. Can you get at the code for the astrisk generating function?
 
Alex,

Thankyou for your comments.

Grnzbra,

Yes, I can get at the code for the asterisk generating function? I'm struggling with this space thing that Alex and yourself are talking about. Can you shed any light?

Thanks

Kate
 
Hi Kate,
This is an existing feature of Access - word wrapping when a space is found. You could probably check if the text that you want to display in the text box contains any white spaces in between words. If so, you could replace those white spaces with some other character like a '*' or '^'. After manipulating the text this way, you could assign it to the text box in which the text is to be displayed and then apply the asterick function. If you are allowin the user to input the text in the same text box, you should use another text box for output.

Hope it is of some help to you.
 
Let's say your text box is 20 characters wide and 2 lines high.

If the length of the string is 15, you would concatinate your string, 4 astrisks, a space and 20 more astrisks. Look at the code for the astrisk function and see if you can modify it to do this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top