title: Crystal Reports - A Subscript must be between 1 and the size of the array
body: <p>The following function returns the "A subscript must be between 1 and size of array"- error when run in Crystal Reports 2013. I have tried to figure this out, but not sure how to fix this error.</p>
  
  <pre><code>Whileprintingrecords;
  stringvar array sMessage := split({Inventory.MessageText},",");
  If UBound(sMessage ) &gt; 0 then
  (
     Trim(sMessage [1]) &amp; Chr(13) &amp; Trim(sMessage [2]);
  )
  </code></pre>
  
  <p>I also tried this...</p>
  
  <pre><code>Whileprintingrecords;
  stringvar array sMessage := split({Inventory.MessageText},",");
  
  Numbervar Array numbers;
  Redim numbers[Ubound(sMessage)];
  
  If UBound(numbers) &gt; 0 then
  (
     Trim(sMessage [1]) &amp; Chr(13) &amp; Trim(sMessage [2]);
  )
  </code></pre>
  
  <p>Any ideas?</p>