Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Import to Memo Field?

Status
Not open for further replies.

gregjohn

Technical User
Aug 13, 2001
29
US
I have an adobe form that I am exporting to a txt file and then saving as an excel worksheet. The adobe form allows the user to a comment section in which they can clarify some answers. As long as the answers are less than 255 characters, everything gets imported ok. However, that is not always going to be the case.

I have changed my foxpro table to accept memo fields. However, when I issue an append from the fields with characters more than 255 come in as null. Any ideas on what I am doing incorrectly?

Thanks
 
I assume you're trying to append from the excel file into your table. That won't work with more than 254 characters in the field even though the table field is a memo.

The only way I've found to deal with this situation is to use excel automation and replace commands. For example, if you have an excel file called BigMemo with potentially larger than 254 characters in the A column and you have a dbf called TestMemo, you might do something like this. Not tested.
Code:
USE TestMemo
oX = CREATEOBJECT('Excel.Application')
oX.Workbooks.Open('BigMemo.xls')
oR = oX.Range('A1')
nCtr = 1
DO WHILE LEN(TRIM(oR.OffSet(nCtr).Value)) > 0
   REPLACE TestMemo.MyMemo WITH oR.OffSet(nCtr).Value
   nCtr = nCtr + 1
ENDDO
Regards,
Jim
 
You might want to try importing directly from the text files or programatically grabing the data directly out of the PDF. Either would be more robust and faster since you'd be skiping Excel.

Brian
 
I have this problem also. I Have a web form that posts to a text file. Some of the fields are longer than 254. If I use a character field in my VFP table, an append command splits the long fields and excess goes into the next field. If I use a memo field, append command does not get the data into the memo field. Will I have to parse the long fields into separate text files and use Append Memo? or parse to an array?

Is there any trick that doesn't require parsing the text file?
 
Two columns of 254 next to each other and a memo field at the end of the table...

Create MyTable (Fields...)
Append from MyFile.txt type sdf
Replace MyMemoFld with CharFld1+CharFld2
Alter Table DBF() Drop Column CharFld1 Drop Column CharFld2
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top