Resizing a field on the fly

G

Guest

I have a form with a header that is a Text box with a piece of text and the
user’s name. The Control Source looks like this:

="Diary Information for " & [Forenames] & " " & [Surname]

The Text box has a Special Effect of Shadowed.

My Problem is that, since peoples names are different lengths I want the box
to resize so that it is never too small or to large.

How can I make the width of the box change to the correct width for the user?
 
A

Al Campagna

Keith,
Use the Len function to determine how long the Len(ForeName) + Len(SurName) string is,
and adjust the width of the text control accordingly.
Use the OnCurrent event of the form, so the change occurs from record to record.
Also, if needed, on the AfterUpdate event of ForeName and SurName.
 
G

Guest

The len command will only give me the number of letters in the name. However
the width of each letter changes depending on what letters are used.

Al Campagna said:
Keith,
Use the Len function to determine how long the Len(ForeName) + Len(SurName) string is,
and adjust the width of the text control accordingly.
Use the OnCurrent event of the form, so the change occurs from record to record.
Also, if needed, on the AfterUpdate event of ForeName and SurName.
--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Keith said:
I have a form with a header that is a Text box with a piece of text and the
user's name. The Control Source looks like this:

="Diary Information for " & [Forenames] & " " & [Surname]

The Text box has a Special Effect of Shadowed.

My Problem is that, since peoples names are different lengths I want the box
to resize so that it is never too small or to large.

How can I make the width of the box change to the correct width for the user?
 
D

Dirk Goldgar

Keith said:
I have a form with a header that is a Text box with a piece of text
and the user's name. The Control Source looks like this:

="Diary Information for " & [Forenames] & " " & [Surname]

The Text box has a Special Effect of Shadowed.

My Problem is that, since peoples names are different lengths I want
the box to resize so that it is never too small or to large.

How can I make the width of the box change to the correct width for
the user?

Stephen Lebans has worked out the necessary details:

http://www.lebans.com/textwidth-height.htm
 
A

Al Campagna

Keith,
Well, of course it doesn't, but... I wouldn't expect it to be "that" critical. I was
assuming you'd work a bit of slack in the width to accomodate the occaisional odd spacing
(like someone named Bob WWWWWWW) :-D
Given that most names would be a mix of some wider characters and some narrower ones,
I would think it would tend to be a wash.

Totally your call...
I'm sure the Lebans solution that Dirk Goldgar suggested will do the trick..
--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


Keith said:
The len command will only give me the number of letters in the name. However
the width of each letter changes depending on what letters are used.

Al Campagna said:
Keith,
Use the Len function to determine how long the Len(ForeName) + Len(SurName) string
is,
and adjust the width of the text control accordingly.
Use the OnCurrent event of the form, so the change occurs from record to record.
Also, if needed, on the AfterUpdate event of ForeName and SurName.
--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Keith said:
I have a form with a header that is a Text box with a piece of text and the
user's name. The Control Source looks like this:

="Diary Information for " & [Forenames] & " " & [Surname]

The Text box has a Special Effect of Shadowed.

My Problem is that, since peoples names are different lengths I want the box
to resize so that it is never too small or to large.

How can I make the width of the box change to the correct width for the user?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top