String Truncated

John.Woody

Registered User.
Local time
Today, 22:31
Joined
Sep 10, 2001
Messages
354
I have the following code
Code:
Public Sub MergeNotes()
Dim db As Database
Dim rs As Recordset
Dim strSQL As String
Dim x As String

strSQL = "SELECT Note.NoteID, [noteTime] & ' - ' & [Reason] & ' - ' & [Result] & ' - ' & [NoteContact] & ' - ' & [NoteText] AS NoteDetail " _
& "FROM ([Note] INNER JOIN Reason ON Note.ReasonID = Reason.ReasonID) INNER JOIN Result ON Note.ResultID = Result.ResultID " _
& "WHERE (((Note.CustomerID) = " & [Forms]![F_Customer]![CustomerID] & ")) ORDER BY Note.NoteID DESC;"

On Error Resume Next

Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
If Err = 3075 Then GoTo Tag1

rs.MoveFirst
If Err = 3021 Then GoTo Tag1

Do Until rs.EOF

x = x & rs!NoteDetail & vbCrLf

rs.MoveNext
Loop

Forms!F_Customer!F_Note.Form!txtNoteText = x

Tag1:

rs.Close
db.Close

End Sub

In the sql NoteText is a memo field. When I run this code it joins them together putting the enter character in where I want it, however it cuts off and doesn't display all the text being generated.

Can anyone tell me why? and how to fix it?
Thanks

Where it cuts off I'm getting then following in the Imediate window
Code:
t?  ? ?????? ?????????? ???? ????????  ?????????  ????????? ??   ???  ??    ?????????    ??  ??? ? ??  ?????????  ??????é ?    ??   ??????  ? ?????????????? ??????? ???????????????????????????????  ?????????????????????????0   ??????D ??????    ???????????? ???????                                ?#     ??      ??    ????      ??       ??    ??   ??  ??  ???#??????? ?"?????  ??
 
Last edited:
Sorted. It didn't like be building the string in the SQL statement for some reason. By changing the SQL to bring each field through seperately, then building the text a recordset level and putting it directly in to the text box instead of in to x it works fine.
 

Users who are viewing this thread

Back
Top Bottom