Re: ListBox question

Hi Russ,

I don’t understand how to apply you macro to my text boxes. Every line in
my ListBox has different information in it. It could look like this:

The cow\jumped\over the\moon
There once was a cow\that\jumped\over the moon

I don’t know how you would load this into a Split(). The text is different
in each line

So when I get to this line in your macro example:
myArray = Split("This\is\a\test.", "\")
do I change it to this:
myArray = Split("\")

then if I highlighted the second one, I have no idea how you get it into the
text boxes?

Text box (TB1) would have “The cow” in it.
Text box (TB2) would have “jumped” in it
Text Box (TB3) would have “over the” in it
Text Box (TB4) would have “moon” in it.

"Russ" wrote:

Run this for a clue for how to use the split function:

Public Sub SplitTest()
Dim myArray As Variant
Dim myLong As Long
'splits string delimited by backslash character.
myArray = Split("This\is\a\test.", "\")

For myLong = LBound(myArray) To UBound(myArray)
MsgBox "<<" & myArray(myLong) & ">>" & " array element #" & myLong
Next myLong

End Sub

Like you said earlier, your command button code would act on your choice by
parsing it with the split() function and by setting each textbox to a part
of the string.

Thanks for answering. So once I highlight one of the strings in my list, how
do I get it to my viewing form?

"Russ" wrote:

The split() function can take a string of text and break it down into an
array by separating the text by a delimiter, in this case the backslash
character. Then yourArray(1) would be the date, the yourArray(2) would be
"NO", etc.

I have the following:

Step #1: With my document open, I open my form and input information.

Step #2: When saving my form information back to my document I load all the
information into a variable. Each field is divided by a Œ\¹. Each time I
the form it added a new record to my variable.

Step #3: I open a new form with a Listbox and load it with my variable. So
in the list box you would see something like this: Œ10/26/2007\NO\Testing\No
change, it all looked good¹ on the first line and if the form had been saved
a second time, the second line it would look like this:
Œ10/31/2007\YES\Testing\No change, it all looked good¹ and so on each time
the form is saved.

Can the following be done?

Step #4: I pick one of the items in the Listbox, then click on my command
button and it would load that information into text boxes in a different
form. The 10/26/2007 would go into TextBox1, ŒNO¹ would go into TextBox2,
ŒTesting¹ into TextBox3 and so on.