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

subscript must be... error

Status
Not open for further replies.

aspnetuser

Technical User
Sep 9, 2004
273
US
I get the subscript must be between 1 and the size of the array using the following formula.

stringvar State := split(trim(split({CSZ},",")[2])," ")[1];

CR 8.5

It works for the records it returns how do i solve the error?
 
That probably means you've got some {CSZ}'s that don't have a comma. Perhaps you can add a check for a comma before attempting to use Split:

StringVar State;
If InStr({CSZ},",") = 0 then
State := "Unknown"
Else
State := split(trim(split({CSZ},",")[2])," ")[1];

-dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top