|
-
Jun 17th, 2010, 02:47 AM
#1
Thread Starter
New Member
[RESOLVED] string variable truncated to 264 characters
I'm trying to add a long sql statement in a string variable, but it's truncated to 264 characters. Since the sql is not complete then the program crashes.
I've made a testprogram for concattenating long strings, and there it works perfectly. Is this a setting of some kind?
The source is as follows, where lclSelectedList is a global variable holding a list of fieldnames, seperated by a "," and the msgbox results in 264:
Dim lclSql As String
Dim lclQuery As String
On Error GoTo process_error
lclConnected = False
lclSql = ""
lclQuery = ""
lclSql = "select " & lclSelectList & " from " & lclTable & " LEFT JOIN tblDocExtraInfo ON tblDocument.docid = tblDocExtraInfo.docid "
If Len(lclCriteria) > 0 Then
lclSql = lclSql & " where "
lclSql = lclSql & lclCriteria
Else
lclSql = lclSql & " where tbldocument.Docid = " & CStr(lclId)
MsgBox Len(lclSql)
End If
-
Jun 17th, 2010, 04:35 AM
#2
Re: string variable truncated to 264 characters
what is the 265th character?
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Jun 17th, 2010, 06:06 AM
#3
Thread Starter
New Member
Re: string variable truncated to 264 characters
The 265 character is a plain character "t", so nothing strange there
-
Jun 17th, 2010, 03:45 PM
#4
Re: string variable truncated to 264 characters
Are you sure it is truncated? Replace your MsgBox line with this & tell us what you get. Open immediate/debug window (Ctrl+G) to see the result:
Code:
Debug.Print "Len="; Len(lclSql): Debug.Print lclSql; "<<"
-
Jun 18th, 2010, 12:14 AM
#5
Thread Starter
New Member
Re: string variable truncated to 264 characters
Don't know what happend, but after a reboot of my system and a restart of VB it works fine now.
Thanks for the help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|