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

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!
 
A

Andreas

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
 
H

HumanJHawkins

<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.
 
H

HumanJHawkins

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!
 

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