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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read [enter] out of memo-field

Status
Not open for further replies.

corine

Programmer
Aug 10, 2000
12
NL
People, Maybe (possibly!) you can help me.

I converted a foxpro-table into access. One field is a memo field, in which linefeeds are used. The field might contain the text "Ordernr: 12345". This can be on the first line or on the second or third etc. The memo-field is never longer then 254, so I converted it to a text-field.
But to get the ordernr out..... I cannot get it. I keep having problems with the linefeed. If I do use as substr it gets more or less....
Something to know: sometimes the text I look for is at the beginning of a line, but sometimes half way or at the end.

Can anyone help me????? Hope so!

Corine
Amsterdam


 
Hi,

Unless the order number has to be a part of your query, it would probably be esiest to return all the contents of the text field and parse it in VB. That would look soemthing like:

------------------------------------------------------------
Rst.open "SELECT MyMemoField FROM tblMyTable WHERE ...", MyConn
if not Rst.eof and not Rst.Bof then
Rst.movefirst
list1.clear
While not Rst.eof
list1.additem mid$(Rst.fields("MyMemoField")
,instr(1,Rst.fields("MyMemoField","Ordernr: ")+8,5)
wend
else
msgbox "nothing to return"
end if
Rst.close
------------------------------------------------------------
Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
Sunaj, thanks for your answer.
But, unfortunately it didn't work. I corrected it a little bit (movenext for example :) ), but then I get the same as my solution.
The problem is the linefeed in the textstring. When the "order" is on the next line, you get strange results. Therefor I tried first to find the carriage return. But that is not as simple as it seems!!!

Regards Corine
 
Hi,

It is no problem to have linefeed/carriage returns inside a string. The problem must be somewhere else. Post your code and I'll take a look at it.

Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
Sunaj
I solved my problem by searching through the archive (for a long time!!). I can now get all the ordernumbers out of the string.
Thanks for your help anyway!!!

Regards Corine
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top