String Variable Truncating At 255 Chars

M

MikeC

I just encountered a new problem I've never seen before.

I have defined a string variable in a standard code module
of AXP and when I set the value, the data gets truncated
after 255 characters.

The online help for the string data type states:

1) A variable-length string can contain up to
approximately 2 billion (2^31) characters.

2) A fixed-length string can contain 1 to approximately
64K (2^16) characters.

Does anyone have any insight into what could be causing
this problem?
 
K

Ken Snell [MVP]

How are you using the string variable? You may be putting it into something
that can only hold 255 characters (such as a text-formatted control or
field).
 
M

MikeC

Ken,

I'm inspecting the value of the variable via the Watch
window.

The variable has *not* interacted with any controls,
tables, recordsets, etc.

Now I'm wondering if the problem is in the Watch window
itself. Maybe the value as it is displayed in the Watch
window is the thing that's getting truncated. I'll do
a "MsgBox Len(MyString)" just to be sure that I know the
true length of the string.
 
M

MikeC

That was it.

Apparently, the Watch window truncates the values at 255
characters. The Len function showed the length of the
string variable to be 892 characters which is about what I
was expecting.

OK. Looks like it's working.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top