Link to home
Start Free TrialLog in
Avatar of mlcktmguy
mlcktmguyFlag for United States of America

asked on

Long Comment is being truncated

I am adding records to a table 'tblCallLog_Worksheet with this code:

'debug.print "Loading the Output Record"
'debug.print "wk_gComment"; wk_gComment
'debug.print "insertComment"; insertComment
'
Dim wkBRT As Long
Dim wkPropertyID As Long
'
'Debug.Print wkComment
'
'
'///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
'

Dim rsOut As ADODB.Recordset
Set rsOut = New ADODB.Recordset
rsOut.Open "tblCallLog_Worksheet", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
'
Dim rsIn As ADODB.Recordset
Set rsIn = New ADODB.Recordset
rsIn.Open "tblSelectedBRTsToProcess_Local", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
'
If rsIn.EOF Then
    Exit Sub
Else
    If rsIn.RecordCount > 0 Then
        '
        rsIn.MoveLast
        rsIn.MoveFirst
        '
        While Not rsIn.EOF
       '     '
            wkBRT = Nz(rsIn!BRT, 0)
            wkPropertyID = GetPropertyIDFromBRT(wkBRT)
            '
            With rsOut
                .AddNew
                    !BRT = wkBRT
                    !PropertyID = wkPropertyID    '  = 0          
                    !CallLogHdrID = insertCallLogHeaderID
                    !User = insertUser
                    !DateTimeAdded = insertDateTime
                    !Comment = insertComment
                    '
                .Update
                '
            End With
            '
            rsIn.MoveNext
        Wend
            
    End If
End If
'
rsIn.Close
Set rsIn = Nothing
'
rsOut.Close
Set rsOut = Nothing
'

Open in new window


This is about as simple and straightforward as it gets.  The issue is that long comments are being truncated when added to the output file.
I attached the layout of the output file

I have the debug.prints (currently commented) above the code that adds the record to the output table.   The debug.print showed the contents of the filed 'insertComment' contained the entire comment.  However, the record created has the comment truncated.  The 'Comment' field in the output table is defined as memo.

Anybody have an idea of why the comment is being truncated?
TableDef.doc
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

what's the data type of field Comment in table: tblCallLog_Worksheet ?

it seems that the field's length is not enough to handle the data that's why it's been truncated.

you may change the data type of field Comment in table: tblCallLog_Worksheet to Memo and try again.
Avatar of mlcktmguy

ASKER

As shown on my attachment containing the file structure, the field is already defined as Memo.
how was the truncated content looks like?

is there any characteristic you can identified from it?
Can you tell if the comments that are getting truncated are all truncated to the same length?  And if so, what is that length?
Also, since you have two recordsets (one in and one out) way below where you have your debug.print statements, I'm curious where the comment is coming from?   I would place the debug.print statement right before the line that sets the !comment field for clarity.
I haven't seen this with DAO, so you could try to convert your function from using ADO to DAO.

/gustav
ASKER CERTIFIED SOLUTION
Avatar of Robert Sherman
Robert Sherman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
One last thought...  right after your ".update" on line 44, if you add a debug.print !comment on the next line, are you seeing the truncation there?
Thanks for the ideas, I had to set this aside temporarily.  I'll check out the ideas and get the information that's been requested this week.