Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-access > #12394

Re: Problem with long character strings

From Ron Weiner <rw@domain.com>
Newsgroups comp.databases.ms-access
Subject Re: Problem with long character strings
Date 2017-02-24 10:08 -0500
Organization WorksRite
Message-ID <o8pi65$bv9$1@dont-email.me> (permalink)
References <21a08bd1-8495-4ebb-8224-ae43ccfb0562@googlegroups.com> <1aebfabe-3334-489a-a603-68eeb014b22d@googlegroups.com>

Show all headers | View raw


Patrick Finucane presented the following explanation :
> On Friday, February 24, 2017 at 9:27:21 AM UTC-5, internet...@foobox.com 
> wrote:
>> I am having a problem with handling long character strings, i.e. those over 
>> 255 characters in length.
>> 
>> In a table I have a memo field named boq_comment.  In one record it contains 
>> the value:
>> 
>> To fine mill the marked area, to remove the HFS surface and then to plane 
>> 30mm off from the remaining area, removing all waste from the site . Cut 
>> suitable tie joints, sweep then apply bond coat to the surface, overlay the 
>> area with 30mm of 6mm SMA surf 40/60 pen 60 PSV to levels and cross-falls.
>> 
>> I can display this in full successfully on a Form even though it is 297 
>> characters long.
>> 
>> I need to access this via a query and when I run that query on its own I can 
>> see the whole field.
>> 
>> My problem comes when I access the query in VBA when creating a Recordset.
>> 
>> dim itemRec as DAO.Recordset
>> set itemRec = Currentdb.openRecordset(“Select * From eDRS_BoQQuery Where 
>> eDRSID = 1537”)
>> 
>> I need to assign the particular field to another variable such as in
>> 
>> x = itemRec(“boq_comment”)
>> 
>> To check that I am getting the expected value I precede this with
>> 
>> debug.print  itemRec(“boq_comment”)
>> 
>> This produces:
>> 
>> To fine mill the marked area, to remove the HFS surface and then to plane 
>> 30mm off from the remaining area, removing all waste from the site . Cut 
>> suitable tie joints, sweep then apply bond coat to the surface, overlay the 
>> area with 30mm of 6mm SMA surf 4 ?7????? m [ ?????7????  ????[ ????      ?
>> 
>> Strange characters are appearing after 255 characters.
>> 
>> Why should this happen?  And more particularly how to I overcome this? 
>> 
>> (truncating to the first 255 characters would seem to be a cop out)
>> 
>> Jim
>
> I ran a test on my computer.  I have Access 2013.  It works as expected, I 
> did not get your results.  You don't say what version of Access you have.  
> You need to verify the table field is set to LONG TEXT for something over 255 
> chars or Memo if Access is prior to Access 2007.

And here with Access 2007.  I used this code

Public Sub GetMemo()
    Dim db As DAO.Database, rs As DAO.Recordset

    Set db = CurrentDb()
    Set rs = db.OpenRecordset("Select * FROM myTable where MyID = 57", 
dbOpenDynaset)
    Do While Not rs.EOF
        Debug.Print Len(rs("mymemo")); rs("mymemo")
        rs.MoveNext
    Loop
    rs.Close
    Set rs = Nothing
    Set db = Nothing
    Exit Sub
End Sub

Which resulted in this following in the Immediate window.

 297 To fine mill the marked area, to remove the HFS surface and then 
to plane 30mm off from the remaining area, removing all waste from the 
site . Cut suitable tie joints, sweep then apply bond coat to the 
surface, overlay the area with 30mm of 6mm SMA surf 40/60 pen 60 PSV to 
levels and cross-falls.

Back to comp.databases.ms-access | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Problem with long character strings internet.shopping@foobox.com - 2017-02-24 06:27 -0800
  Re: Problem with long character strings Patrick Finucane <patrickfinucanetx@gmail.com> - 2017-02-24 06:54 -0800
    Re: Problem with long character strings internet.shopping@foobox.com - 2017-02-24 07:07 -0800
      Re: Problem with long character strings Patrick Finucane <patrickfinucanetx@gmail.com> - 2017-02-24 09:06 -0800
        Re: Problem with long character strings Ulrich Möller <knobbi38@arcor.de> - 2017-02-24 18:42 +0100
    Re: Problem with long character strings Ron Weiner <rw@domain.com> - 2017-02-24 10:08 -0500
      Re: Problem with long character strings internet.shopping@foobox.com - 2017-02-24 07:48 -0800
        Re: Problem with long character strings Ron Weiner <rw@domain.com> - 2017-02-24 11:06 -0500
      Re: Problem with long character strings Ulrich Möller <knobbi38@arcor.de> - 2017-02-24 17:14 +0100
        Re: Problem with long character strings internet.shopping@foobox.com - 2017-02-24 09:35 -0800

csiph-web