Help with formatting text in a textbox

  • Thread starter Thread starter Corey-g via AccessMonster.com
  • Start date Start date
C

Corey-g via AccessMonster.com

Hi All,

I have been trying everything I can think of, and still not getting the
results I'm after. I am trying to summarize an order in a textbox, by
building a string and assigning it to the caption property of the text box.
I create a recordset based on what's in the table, then loop through it and
build my string(s).
I want to display everything nicely, so I am trying to space each field so
that I can put in a header row of labels, and then have each record show
nicely spaced below.

I am now finding that even when I take into account the length of the data
inthe field, I still can't get it to line up correctly -

Qty Part Number Rush
1 SHL-OP-00303 No
1 LINKSYS-KVM2KIT No
2 LKS-WRT54G No



If you count the spaces between, they are all equal - but don't line up. Is
there a font that keeps all characters the same size? Or another way to
accomplish this?

Qty Part Number Rush
1 SHL-OP-00303 No
1 LINKSYS-KVM2KIT No
2 LKS-WRT54G No

Any thoughts or suggestions would be appreciated...

Corey
 
Why not just use another control? A listbox would give the same kind
of effect without the hassel.
 
It's so they can copy and paste it into an email.
Why not just use another control? A listbox would give the same kind
of effect without the hassel.
 
Well, you may want to consider including the ability to email from
Access. Then the message can be constructed in many different ways.

If you need to continue the way you are, short of employing some
complex code to determine the width of a particular piece of text, I
think only monospace fonts provide what you are looking for. These are
usually NOT true-type fonts. I think the most common would Courier.
 
Thanks Marshall,

I will try the Courier font. To explain 'why' I'm cramming this into a text
box control, I need the user to be able to copy and paste everything into an
email, including some other lines about the order. I guess I don't know a
better way, so I figured making a large textbox was the way to go. The user
can select all and copy and paste everything into an email in one step. The
layout I origianlly posted is only the second half of what is laid out in the
textbox. If there is an easier way to do this, please advise.

Thanks again,

Corey
 
Corey-g via AccessMonster.com said:
I have been trying everything I can think of, and still not getting the
results I'm after. I am trying to summarize an order in a textbox, by
building a string and assigning it to the caption property of the text box.
I create a recordset based on what's in the table, then loop through it and
build my string(s).
I want to display everything nicely, so I am trying to space each field so
that I can put in a header row of labels, and then have each record show
nicely spaced below.

I am now finding that even when I take into account the length of the data
inthe field, I still can't get it to line up correctly -

Qty Part Number Rush
1 SHL-OP-00303 No
1 LINKSYS-KVM2KIT No
2 LKS-WRT54G No



If you count the spaces between, they are all equal - but don't line up. Is
there a font that keeps all characters the same size? Or another way to
accomplish this?

Qty Part Number Rush
1 SHL-OP-00303 No
1 LINKSYS-KVM2KIT No
2 LKS-WRT54G No


To answer your specific question. Courier is a
non-proportional font.

However, I must say that I can not understand why you would
want to try to cram all this into a single text box.
Normally, this kind of effect is achieved in a report by
just using 3 text boxes in the detail section. In a form,
it is commonly done by using a continuous subform or even a
list box.
 
Of course - thanks for pointing that out, as I hadn't thought of that. I
likely would have been posting back once that was discovered.

How does one take all the information entered, and summarize it so that it
can be emailed. I want to add in automation for emailing, but that is out of
scope right now. May get to do that in one of the next versions, but for now
this is what Iwas asked to provide...

Thanks for the heads up on the ultimate outcome of changing the font Marshall.


Corey
 
Thanks Storrboy, I didn't see your reply about the font before replying to
Marshall. The complex code you discuss really isn't that complex though -
just using the LEN() function and subtraction. I only have 3 fields - so
it's pretty easy. If there was 5 or more, I could see it getting pretty
complex though...

Corey
 
I didn't think about the mail font either, but with a true-type font
Len() does not tell you how long the string is on screen.
These two lines have the same number of characters.

WWWWW 1234
lllll 1234

There is a way to determine how much screen space text uses, but at
the moment I can't remember what it is. And even then, it wouldn't
apply after it was cut and pasted.

It may be better to use a formated report or spreadsheet and mail
that.
 
Corey-g via AccessMonster.com said:
I will try the Courier font. To explain 'why' I'm cramming this into a text
box control, I need the user to be able to copy and paste everything into an
email, including some other lines about the order. I guess I don't know a
better way, so I figured making a large textbox was the way to go. The user
can select all and copy and paste everything into an email in one step. The
layout I origianlly posted is only the second half of what is laid out in the
textbox. If there is an easier way to do this, please advise.


Watch out! The font you use in the text box is unlikely to
be the same font in a user's email program and you will be
right back where you started as far as how it looks.
 
Corey-g via AccessMonster.com said:
Of course - thanks for pointing that out, as I hadn't thought of that. I
likely would have been posting back once that was discovered.

How does one take all the information entered, and summarize it so that it
can be emailed. I want to add in automation for emailing, but that is out of
scope right now. May get to do that in one of the next versions, but for now
this is what Iwas asked to provide...


Maybe storboy can help with emailing. About I can suggest
is that you print a report to a PDF or Snapshot and email
that as an attachment.
 
My original thought about sending mail from Access incorrectly ignored
the column spacing the OP was after. I was later talking about the
same thing - mailing an attachment (pdf, xl, snapshot whatever) but I
see I did not do so clearly. Sorry.

At this point I think aligning the text in a single textbox is
impractical at best. I did though have a thought involving tab spacing
and intend to look into it unless others know this won't work, but it
may be a while.
 
The Tab character is not useful. The only control
characters that a text box can process is the CrLf
combination.


Good to know. I was thinking more on the output to the email or other
text destination. I know different editors (text or otherwise) do
different things with tab characters, but not what happens when they
encounter them from a different source.
 
storrboy said:
My original thought about sending mail from Access incorrectly ignored
the column spacing the OP was after. I was later talking about the
same thing - mailing an attachment (pdf, xl, snapshot whatever) but I
see I did not do so clearly. Sorry.

At this point I think aligning the text in a single textbox is
impractical at best. I did though have a thought involving tab spacing
and intend to look into it unless others know this won't work, but it
may be a while.


The Tab character is not useful. The only control
characters that a text box can process is the CrLf
combination.
 
storrboy said:
Good to know. I was thinking more on the output to the email or other
text destination. I know different editors (text or otherwise) do
different things with tab characters, but not what happens when they
encounter them from a different source.


Good point. Try a couple and see how it works.
 
Back
Top