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

Converting a string to an array

Status
Not open for further replies.

denaex

Programmer
Nov 2, 2001
6
0
0
US
'Change POC Name to either Current POCID or Changed New POC Names
'Check POC_ID
'if POC_ID = 0 then no change was made so keep the old POCName
'***************************************************************************************************
ReDim arrChangedPOCName(40), arrChangedPOCType(MaxtblLabPOC)

strChangedPOCName = Trim(strChangedPOC)

'arrChangedPOCName = Split(strChangedPOCName, ", ", -1, 1)

For iIndex = 0 to 5
' If (arrChangedPOCName(iIndex) = "0") Then
If strChangedPOCName(iIndex) = 0 then
arrNewPOCName(iIndex) = Session("arrayCurrentPOC")(iIndex) 'Old Names
Else
arrNewPOCName = (StrChangedPOCName) 'New Names
End If
Next
 
Error Message comes out either TYPEmismatch or Subscript out of range.
 
Why are you referencing "strChangedPOCName(iIndex)" (first non-commented line in For loop)? strChangedPOCName is a string, not an array.
 
The commented out array statements did not work. When referencing the array as in the second commented out array statement, it returned an error on index out of subscript or Type mismatch...

So the question is how do I put this string into an array then reference the array without getting an error??

This should be easy right?
 
Hi,

Try below code

Dim strArray

strArray = Split(strChangedPOCName, ", ", -1, 1)

For i = lbound(strArray) to ubound(strArray)
response.write strArray(i) & &quot;<br/>&quot;
Next

It should work anywhere.

Cheers !

Ted
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top