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

Formatting Text

Status
Not open for further replies.

Otacustes

IS-IT--Management
Apr 15, 2005
40
GB
I have a problem formatting text in a rich text control on an Access Form.

On the clipboard I have an array in the following format:
ITEM<TAB>PART<TAB>QTY<TAB>DESC<CR>1<TAB>ABC123<TAB>1<TAB>WIDGET<CR>...

As you can see each record is delimited by a carriage return whilst each field is delimited by a tab.

What I need is a function that will remove the tabs (keeping the carriage returns) and replace them with variable length text so that the columns line up when inserted into the rich text box on the form, as shown below:

ITEM PART QTY DESC
1 ABC123 1 WIDGET

Anyone have any previous code or can offer some guidance it would be appreciated.

Thanks
 
Gday Ota,

Set the font of the box to courier new, a proportional font. Establish the widest column required using the len function. Loop through each of your values using the space$ function to add padding spaces.

just break it into small steps, use pseudo code and using instr, mid, left string manipulation functions together with the concatenation method of & you'll be fine.

Good luck,

JB
 
Hi JB
I cannot get the font to Courier. There is not a property that enables me to change the font and if I try to do it programatically it is ignored!! There was not even a property to set when I tried programatically so I tried .font = "courier" and it accepted it even though it does nothing!!

I am using a MSForms text control on my form (Access 2K7) with the enter property set to yes.

Do you have any ideas why the font property is not available?
 
Got it working after all JB...

I went back to a regular textbox (not one from the activeX menu) and changed the code to delimit by vbcrlf and not vbcr.

I managed to change the font as well!!

Thanks for the pointers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top