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!
Andreas - 02 Apr 2005 13:16 GMT
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
> Hi,
>
[quoted text clipped - 19 lines]
> Can anyone suggest the reason for this (or better yet, a solution)
> Thanks!
HumanJHawkins - 03 Apr 2005 03:56 GMT
<CUT>
>> 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
[quoted text clipped - 15 lines]
>> TextBoxCombined = TextBoxSource1 & TextBoxSource2
>> End Function
<CUT>
<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 - 04 Apr 2005 22:58 GMT
> Hi,
>
[quoted text clipped - 7 lines]
> 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!