Updating a TextBox with More than 255 Chars with VB and Access 2002?

  • Thread starter Thread starter HumanJHawkins
  • Start date Start date
H

HumanJHawkins

Hi,

I have an .adp connected to a SQL database. I've made a form with a TextBox
connected to a varchar(1024) in the SQL database. I am trying to use VB to
update this text box with the concatenation of text from other fields.

The SQL field, the Text box, and the strings from VB can all handle more
than 255 characters. But whan I use VB (triggered by a button on the form)
to update the text box, it fails if the combined text is longer than 255
chars.

In case it helps, the failure is a little odd... Instead of truncating when
255 chars is exceeded, this actually chops off the first 255 characters once
it is exceeded. So, under 255 works perfectly. But if I go over 255 by one
word, only that one word is put into the text box.

The function is:
Function CombineStuff()
TextBoxCombined = TextBoxSource1 & TextBoxSource2
End Function

Can anyone suggest the reason for this (or better yet, a solution)
Thanks!
 
No idea why this is happening.
Only thing that springs to mind id to use a variable:
Function CombineStuff()
Dim strText as String
strText = TextBoxSource1 & TextBoxSource2
TextBoxCombined = strText
End Function

Hope this helps,
Regards,
Abdreas
 
<CUT>

Only thing that springs to mind is to use a variable:
Function CombineStuff()
Dim strText as String
strText = TextBoxSource1 & TextBoxSource2
TextBoxCombined = strText
End Function

Thanks for the suggestion. I tried it, but it did not help.
 
HumanJHawkins said:
Hi,

I have an .adp connected to a SQL database. I've made a form with a
TextBox connected to a varchar(1024) in the SQL database. I am trying to
use VB to update this text box with the concatenation of text from other
fields.

The SQL field, the Text box, and the strings from VB can all handle more
than 255 characters. But whan I use VB (triggered by a button on the form)
to update the text box, it fails if the combined text is longer than 255
chars.
<CUT>

The answer is that Access will not send more than 255 chars to a varchar,
even if it can hold more. However, changing the varchar to a "Text" data
type works around this bug in Access.

Cheers!
 
Back
Top