Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / SQL Server / ADP / April 2005

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
HumanJHawkins - 02 Apr 2005 06:55 GMT
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!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.