Memo to String

  • Thread starter Thread starter Rob
  • Start date Start date
R

Rob

Hi,

I have to convert the content of a memo field into some
text fields.
How can I do that?

Thanks,
Rob
 
As you can guess a memo is just a VERY long string.... so, programatically,
there is no difference. However, for access there is a difference. Access
can't do searches through them etc... there are two ways I can think of to
convert memo's to a text field.... and the first is the easiest.

1) FIRST THINGS FIRST! MAKE A BACKUP!
in the design window of the table... change the data type to a text and
make sure the field size is bigger than the biggest memo in the table. Save
& it'l warn you you could lose data. You won't unless you made the field
size too small. If you're worried about this... try the 2nd option.

-or-

2) ALWAYS MAKE A BACKUP!
open two record sets... 1 for reading from the existing table and 1 for
writing information to a new table.
while not rs1.eof
rs2!field1 = rs1!field1
rs2!field2 = rs1!field2
rs2!field3 = rs1!field3
...
rs2!myText = left(rs1!myMemo,fieldsizeofRS2'sMYTEXTfield)
rs2.update
rs1.movenext
loop
this is probably the slower method to fix your problem... but the most
reliable. If you have a memo field bigger than the text field size, it'l
trim it to the right length & put it in anyway.

if you have records in the table where the memo field is > 255 characters
and don't want to lose a single character, you're outa luck. The text
field's maximum is 255 characters. (access stupidity)

I hope this helps.

:)
 
Back
Top