[AccessD] Query Truncating Data

ranthony at wrsystems.com ranthony at wrsystems.com
Wed Apr 7 08:33:13 CDT 2004


See M$ KB 170218.

A workaround I used in an older program is as follows (this is A97):

'The following lines of code is a workaround provided by MS due to W97
inability to assign the value of a variable containing
    'more than 255 characters.  This is obviously a non-starter, as the
fields indicated are memo fields in Access.
    'The formfield is populated with asterisks as a placemark, the document
then has to be unprotected, then the contents are
    'dumped into the formfield.  After that, the asteriks are deleted, and
the protection for the document is reinstated.
    'The if statement is so this processing effort won't be invoked unless
the field is not null and contains more than 255 characters.
    '
    
    If Not IsNull(Forms!frmstrinput!txtBrief) And
Len(Forms!frmstrinput!txtBrief) > 255 Then
        'set Description form field to a unique string.
        WordObj.Documents(1).FormFields("Description").Result = "****"
        If WordObj.Documents(1).ProtectionType <> wdNoProtection Then
            WordObj.Documents(1).Unprotect Password:="bob"
        End If
        WordObj.Selection.Goto what:=wdGoToBookmark, Name:="Description"
        WordObj.Selection.Collapse
        WordObj.Selection.MoveRight wdCharacter, 1
        WordObj.Selection.TypeText (Forms!frmstrinput!txtBrief)
        WordObj.Selection.Goto wdGoToBookmark, , , "description"
        'Remove unique characters from Description form field
        With WordObj.Selection.Find
            .Execute findtext:="*", replacewith:="", replace:=wdReplaceAll
        End With
        WordObj.Documents(1).Protect Password:="bob", noreset:=True,
Type:=wdAllowOnlyFormFields
    
    Else
        WordObj.Documents(1).FormFields("Description").Result =
IIf(IsNull(Forms!frmstrinput!txtBrief), "", (Forms!frmstrinput!txtBrief))
    End If

-----Original Message-----
From: Paul Liadis [mailto:pnl1 at psu.edu] 
Sent: Wednesday, April 07, 2004 9:22 AM
To: Access Developers discussion and problem solving
Subject: [AccessD] Query Truncating Data

Hello,
I am having a problem with a query in which my data is being truncated to 
255 characters.  My query simply selects from a table (linked from SQL 
Server), but doesn't return all the data in one of the columns (defined as 
memo in Access).  The data is being truncated even though it exists in the 
table.  Has anyone experienced this?

Thanks,

===============================================
Paul Liadis
Senior Applications Programmer/Analyst
University Budget Office
Pennsylvania State University

-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list