Characters to textbox

Tark221

Registered User.
Local time
Today, 07:32
Joined
Oct 12, 2012
Messages
74
Hi all,

I'm stuck. I have a textbox with about 400 characters, I also have 5 textboxes next to it. I want to click a button and I want to transfer the characters to the other textboxes 208 characters at a time.

Any ideas ?

Thanks
 
This is messy, but it should work:

Code:
Dim intCount As Integer
Dim iBox As Integer

intCount = Len(Me.OriginTextBox)

Do While intCount > 0
    Me.Controls("TextBox" & iBox) = Left(Me.OriginTextBox, 208)
    Me.OriginTextBox = Mid(Me.OriginTextBox, 209)
    intCount = intCount - 208
    iBox = iBox + 1
Loop

This assumes your original 400 character text box is named 'OriginTextBox' and that each of the boxes to transfer to are named 'TextBox1','TextBox2', etc.

Though I have to ask.... Why are you transferring the text to separate boxes? Would a memo field as your original field not work???
 
thanks for the fast response, I will try this solution tomorrow when I'm in work. It could come from a memo field, I didn't realise this could be done with this solution. Still quite new to VBA and access.
 
Thanks for the code, it worked really well.

just another question how would I go about it if I wanted to expand on your solution and make it so there are 75 characters a line while still maintaining the 208 characters a box, any help would be appreciated.

thanks
 

Users who are viewing this thread

Back
Top Bottom