Select to view content in your preferred language

ArcGIS 10, SP4 VBA String Variables limited to 250 characters long

821
1
05-23-2012 12:58 PM
RichardFairhurst
MVP Honored Contributor
For some reason, VBA scripts I have used for years can now only store 250 characters in a string variable.  I know that String variables used to be ablle to hold at least 2048 characters.  I have used a watch variable and verified that string variables stop appending charaters after 250 characters have been added to the string.  250 characters is too short to create many of my WhereClause Strings and causes many of my VBA feature selection queries to fail.  My VBA scripts continue to work as long as all of the strings created in the script are 250 characters long or less.

I think this limitation may have been introduced with ArcGIS 10, SP 3.  Can anyone else test whaterver ArcGIS 10 Service Pack they have and report the maximum number of characters they can store in a VBA String variable?  I need to know the last Service Pack where strings held about 2,048 characters so I can roll my installation back (at least until my scripts are converted to VB.Net).

I originally thought I had installed SP 4, but in fact I am using SP 3, so that is where the limit seems to have occurred for me.
0 Kudos
1 Reply
RichardFairhurst
MVP Honored Contributor
I have determined that VBA does not have a 250 character limit as I originally thought.  I was mislead into thinking that by using a watch variable, which does have a 250 character limit, but the string variable itself did not have this limit.  I was able to demonstrate the string was not truncated by using a Msgbox output.

I have determined that my problem was due to a change by the DBA to the way values were stored in a field.  The change (removal of leading spaces from the values of a text field) caused my query string to be invalid and fail.  I was not notified of the change, but eventually discovered the alteration.  By changing my code to trim out leading spaces in my query string values and conform to the current field values I have resolved my problem.  Sorry for the faulty interpretation of what I thought was my problem.

To repeat, VBA strings at ArcGIS 10 do not have any change to the number of characters that can be stored relative to any previous version.
0 Kudos