I want to split a string in a textbox into many text boxes each box containing one word using vba in Access
so lets say the text box name text1 and it contains a string like hello I'm asking a question
I want to split that string into text boxes so it would be like
text2 = hello
text3 = I'm
text4 = asking
...etc
is there an easy way to do it?
Access has a built in split() command that will do this.
So, this code will work:
Dim v As Variant
Dim sOne As Variant
Dim i As Integer
v = Split(Me.TextBox0, " ")
i = 0
For Each sOne In v
i = i + 1
Me("text" & i) = sOne
Next
So above would take the string from a textbox0 on a form, and put say 3 values into textbox 1 to 3.
So a large whack of code is not required.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With