Text Boxes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

We recently switched from Access 97 to Access 2002 and I have been having
trouble recreating what I used to do in Access 97 with text boxes. In Access
97 I used to be able to press the enter key (hard return) to get a portion of
text to move to the next line. In Access 2002 it doesn't seem to work
anymore. All I get is a box character where I put the hard return and all the
text stays on the same line. Using multiple text boxes for each line is not
an option in my situation. Below is an example of what I would do in the
expression builder for the text box in Access 97.

eg.

="Hello
World"

would come out as

Hello
World

But in Access 2002 it comes out as

Hello(box character) World

What drive me nuts is the text boxes in the reports that were developed in
97 and converted to 2002 still work fine but when I try to create a new text
box in 2002 with text on multiples line it doesn't work!

Can some please give my head a shake and tell me what I am doing wrong here..

Thanking you in advance!!

JT
 
Sorry that's the first thing I tried and it doesn't work!! It puts that box
character at the point where I select Ctl-Enter and the rest of the text
doesn't move to the next line.. Anybody else got something better..
 
Sorry that's the first thing I tried and it doesn't work!! It puts that box
character at the point where I select Ctl-Enter and the rest of the text
doesn't move to the next line.. Anybody else got something better..

Set the Enter Key Behavior property to New Line in Field.
It's on the Control's property sheet's Other tab.
 
Hi Fred,

You don't have that property available on a text box in a report, only on a
form. I am working with reports.
 
J. Toews said:
Hi

We recently switched from Access 97 to Access 2002 and I have been having
trouble recreating what I used to do in Access 97 with text boxes. In Access
97 I used to be able to press the enter key (hard return) to get a portion of
text to move to the next line. In Access 2002 it doesn't seem to work
anymore. All I get is a box character where I put the hard return and all the
text stays on the same line. Using multiple text boxes for each line is not
an option in my situation. Below is an example of what I would do in the
expression builder for the text box in Access 97.

eg.

="Hello
World"

would come out as

Hello
World

But in Access 2002 it comes out as

Hello(box character) World

What drive me nuts is the text boxes in the reports that were developed in
97 and converted to 2002 still work fine but when I try to create a new text
box in 2002 with text on multiples line it doesn't work!

Can some please give my head a shake and tell me what I am doing wrong
here..

Somehow you are dropping a character. Access only recognizes the two
character combination of Chr(13) followed by Chr(10) which are
CarriageReturn and LineFeed respectively. A field that contains only one
or the other will behave as you are seeing with a small box which is what
Access displays any time it encounters a non-printable character.

I have no idea why that would be happening though.
 
You can use Chr(13) & Chr(10) between strings to insert a return. Not sure
if that helps you or not.

= [SomeField1] & Chr(13) & Chr(10) & [SomeField2]


Hope that helps,

Rick B
 
J. Toews said:
We recently switched from Access 97 to Access 2002 and I have been having
trouble recreating what I used to do in Access 97 with text boxes. In Access
97 I used to be able to press the enter key (hard return) to get a portion of
text to move to the next line. In Access 2002 it doesn't seem to work
anymore. All I get is a box character where I put the hard return and all the
text stays on the same line. Using multiple text boxes for each line is not
an option in my situation. Below is an example of what I would do in the
expression builder for the text box in Access 97.

eg.

="Hello
World"

would come out as

Hello
World

But in Access 2002 it comes out as

Hello(box character) World


It doesn't come out that way for me when I type
="Hello{Ctrl+Enter}World"
in the control source property of a text box.

If worse comes to worse, you could also use the less
convenient
="Hello" & Chr(13) & Chr(10) & "World"

OTOH, If you want to display a constant string, why not use
a Label control instead?
 
Because I am not displaying a constant string. I have to call functions
from the text boxes to provide me with the proper dates because the reports
produce year over year - month over month comparisons, based on what date
period the user wants to see a report for. You can not call a function from
a label, at least in Access 97 you couldn't, didn't try it with 2002.. So
the column headers have to be set so they can show any date. It saves me
from having to change labels in 30 different reports everytime a user wants
to see a report with different date comparisons becasue they supply the
parameters and my functions set the text box based on their parameters.

eg. in Access 97 my control source on my text boxes would look something
like this.

=SetPrevYear() & " =SetCurrYear() & "
Expenses" Expenses"

which prints as:

2003/04 2004/05
Expenses Expenses

There is always a method to my madness..
 
Thanks Marshall!! Your method works. I should have know.. I tried using
chr(10) and chr(13) but not at the same time.. But I have to say just
hitting the enter key in Access 97 is a lot less hastle!!.. Must be a new
FEATURE or IMPROVEMENT!!
 
J. Toews said:
eg. in Access 97 my control source on my text boxes would look something
like this.

=SetPrevYear() & " =SetCurrYear() & "
Expenses" Expenses"

which prints as:

2003/04 2004/05
Expenses Expenses

With all those misplaced quotes, missing & and an extra =, I
hope it only looked vaguely like that.

Whatever, in A2002, I can get that result with the text box
expression:

=SetPrevYear() & " " & SetCurrYear() & "{Ctl+Enter}
Expenses Expenses"

so I still don't know what your issue is.
 
I know this chatter can go on and on but I don't like to leave unanswered
questions and I don't like people thinking I haven't got a clue.

Sorry for the confusion, the example I gave was for two seperate text boxes
side by side for different columns on the same report. I couldn't draw lines
around it to illustrate that becasue this is a text posting I guess I figured
you would know what I meant. I just wanted to give you an example of a
report layout and why I don't use labels, which was because the column header
strings are not constant, they change based on different parameters.

So, there were no extra "=" signs, and it wasn't missing any "&" characters
or there wasn't any misplaced quotes.

Still, <crtl><enter> would not work on my machine, I am not crazy and I am
not lying, it just wouldn't work! I thought maybe there was a new "FEATURE"
with report text boxes. But since <ctrl><enter> works on your machine the
only explanation I can think of is we recently had a refresh from NT to XP -
Office 97 to Office 2002 plus new workstations and the network people have
some bugs to work out. Or maybe it's just my edition of Access, I don't
know, but I would like to know why? Workarounds are fine but I would like to
know why <ctrl><enter> doesn't work for me. Just my curiosity and my thirst
for knowledge I guess.

Anyway, so the only way I could get the result I needed was by using the
character sets (13) and (10). I know you can't answer what the problem is
over here so I guess I'll have to take it up with the network people (man I
hate those SOB's).

I hope that answers any questions or at least dispells your impression of me
being a moron!!

Thanks Marshall..
 
J. Toews said:
I know this chatter can go on and on but I don't like to leave unanswered
questions and I don't like people thinking I haven't got a clue.

Sorry for the confusion, the example I gave was for two seperate text boxes
side by side for different columns on the same report. I couldn't draw lines
around it to illustrate that becasue this is a text posting I guess I figured
you would know what I meant. I just wanted to give you an example of a
report layout and why I don't use labels, which was because the column header
strings are not constant, they change based on different parameters.

So, there were no extra "=" signs, and it wasn't missing any "&" characters
or there wasn't any misplaced quotes.

Still, <crtl><enter> would not work on my machine, I am not crazy and I am
not lying, it just wouldn't work! I thought maybe there was a new "FEATURE"
with report text boxes. But since <ctrl><enter> works on your machine the
only explanation I can think of is we recently had a refresh from NT to XP -
Office 97 to Office 2002 plus new workstations and the network people have
some bugs to work out. Or maybe it's just my edition of Access, I don't
know, but I would like to know why? Workarounds are fine but I would like to
know why <ctrl><enter> doesn't work for me. Just my curiosity and my thirst
for knowledge I guess.

Anyway, so the only way I could get the result I needed was by using the
character sets (13) and (10). I know you can't answer what the problem is
over here so I guess I'll have to take it up with the network people (man I
hate those SOB's).

I hope that answers any questions or at least dispells your impression of me
being a moron!!


Sorry, I didn't mean to imply anything moronic, I thought
those were just typos. Should have added a smiley.

Aside from some funky keyboard setting, the only thing I can
think of is to make double sure that the Ctrl+Enter is
inside the quotes.

Beyond that, I'm at a loss to explain it.

Try it on some other machines in the office to see if
they're all like that??
 
I was having the EXACT same problem, but Marshall actually hit on the
solution in his last post...

you have to hit CTRL + ENTER INSIDE THE QUOTES.

I never would have figured it out either.

-gail
 
There seems to be more to this than meets the eye . . . .

Having read all of this thread (and the one entitled "Concatenating Fields"
which is a little too intense) I think that much depends upon the "file
version" option that is taken when "upgrading" . . . . .

I have databases that have their origins in Access97, Access2000 and now
Acess2003. I too would like to "Start a new line" within a text box in a
report. . . . .

Sometimes, whatever I try I get little square boxes, other times the
technique works fine until I "compact and repair" as is good practice and
then it works no more.

Sometimes, trying the CHR(10) etc thing (See the Concatenating Fields
Thread) Access2003 simply removes that bit of the text box!!

For sure, the suggestion below does work some time . . . . I would like to
have a definate answer (and reason) Please . . . . .

Yours
Charles
 
it's not really clear to me whether you are talking about "going to the next
line" during data entry in a form's textbox, and then having the saved data
show up with the same line formatting in a report - or taking a string of
data from a text field in a table, and manipulating it to display as
multiple lines in a report.

if you're talking form data entry: you can press Ctrl+Enter during during
data entry to move to the "next line" in a textbox. or you can set the
textbox's EnterKeyBehavior property, in form design view, to New Line in
Field, and then just press Enter to begin a new line. (to exit the textbox
during data entry, press Tab instead of Enter.) either way, the data should
show up in the report in multiple lines, as entered. in the report, you may
have to set the textbox control's CanGrow and CanShrink properties to yes -
and ditto for the report's Detail section.

to manipulate text data into multiple lines from within a query, you can
concatenate the strings with the characters that create a hard carriage
return, as

"you can try this " & Chr(13) & Chr(10) & "out and see if it works."

again, to display the multiple lines in a report, see the above remarks re
CanGrow and CanShrink properties.

hth
 
Dear Tina,

First, thank you for your response ~ it has allowed me to undertake some
sensible experimentation . . . .

To answer your first paragraph ~ My problem was as stated by J Towes in the
very first aspect of theis "thread".

Next (but not in order) you suggested:

"you can try this " & Chr(13) & Chr(10) & "out and see if it works."

. . . . and here, the important aspect is that BOTH must be used, if just
one of them is used them the "little squares" appear!! (This caused me lots
of wasted time ~ I never thought to try them concatenated as obvious as that
NOW appears!)

Next, the use of the "EnterKeyBehavior property," which I am sure would work
and is now in my mind as a strategy to consider in future.

I now believe that the answer IN A TEXT BOX is to use the following structure:

=[Field1]&" > > ShiftEnter
"[Field2] > > Note this line starts with a second Quote mark

Which is very easy (incidentally, CtrlEnter works too)


However, IN A QUERY, this produces the "little squares" again BUT the
=[field1] & Chr(13) & Chr(10) & [field2] strutures works very well!!

I am now content that I can produce the desired effects I require.

Thank you all that have contributed.

PS there is a similar issue in Excel

(To avoid misery, the answer in there is ONLY use CHAR(10) and also set the
"TextControl" in the "Alignment" tab of the "Cell Format" to "Wrap Text" or
guess what?

.. . . . the little squares appear again!!

Don't you just love consistent software!!

Your Aye
Charles
 
Back
Top