Access Reports - Word Wrapping in a Text Box

M

mattieflo

One of the requirements for one of our projects is for a text box in a
report, if they have something in the field like 'RFE_TRR_SEX' and it has to
wrap in the text box, that it wraps right after an underscore. Anyone have
any idea where to start on this one?
 
R

roger

an idea of where to start, sure:

You'll need to know how many characters will fit in a line
then you'l use an Instr() to find the last underscore before that number
then you use a left() to get a string upto that underscore
add a vbcrlf (hard return) and add the rest of the string with a Right()

its a little more complex if you have >2 lines
 
J

Jim Burke in Novi

If you want 'RFE_TRR_SEX' to appear as

RFE
TRR
SEX

then the split function should help you do that. Define an array (it may
have to be type VAriant, not positive about that), then do something like:

myArray = Split(myFIeld, "_")
txtField = vbnullstring
for i = 0 to ubound(myArray) - 1
if i > 0 then
txtField = txtField & vbcrlf
end if
txtField = txtField & myArray(i)
next i

Something along those lines should work, if you're looking for the result I
mentioned above.
 

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