Access send data in memo to text file 
Author Message
 Access send data in memo to text file

Pardon the cross post, but I really couldn't figure out where this one
belonged.

If I have some text in a memo or memory variable, how would I write it to a
text file?

Thanks in advance!

--

Remove word NOSPAM from email to reply.



Mon, 16 Jul 2001 03:00:00 GMT  
 Access send data in memo to text file
I've even tried to have:
a) a design master
b) a replica
c) an online MDB.

I tried to export the tables from the replica to the online MDB. I would
then put the online on the web for a while, bring it back and try to bring
the tables back into the replica. This doesn't work since the replica will
not let me delete its table.

--

Remove word NOSPAM from email to reply.

Quote:

>Pardon the cross post, but I really couldn't figure out where this one
>belonged.

>If I have some text in a memo or memory variable, how would I write it to a
>text file?

>Thanks in advance!

>--

>Remove word NOSPAM from email to reply.



Mon, 16 Jul 2001 03:00:00 GMT  
 Access send data in memo to text file
Ignore the second message. It belongs with another post! Sorry!

--

Remove word NOSPAM from email to reply.

Quote:
>I've even tried to have:
>a) a design master
>b) a replica
>c) an online MDB.

>I tried to export the tables from the replica to the online MDB. I would
>then



Mon, 16 Jul 2001 03:00:00 GMT  
 Access send data in memo to text file
See the "Writing Data to Files" topic in Access's online help.

Also see the following statement topics:

Open Statement
Close Statement
FileFree Statement
Print #
Write #
Input #
Line Input #

Use the Print # statement to write undelimited data.  Use the Write #
statement to delemit your file.

Here's an example:

Dim FileNumber as Integer
Filenumber = FreeFile
Open "Drive:\Path\Filename" for Append as #Filenumber
Write #Filenumber, Me!MemoField
Close #Filenumber

More examples are given in online help.

Regards,
Glenn Tarpley
GDTUSA
Resources for Programmers
http://www.concentric.net/~Gdtusa/

Quote:

>Pardon the cross post, but I really couldn't figure out where this one
>belonged.

>If I have some text in a memo or memory variable, how would I write it to a
>text file?

>Thanks in advance!

>--

>Remove word NOSPAM from email to reply.



Tue, 17 Jul 2001 03:00:00 GMT  
 Access send data in memo to text file
Glen,
Thank you for the reply. If I am understanding you correctly, then the
following function should write a variable to a file:

dim x
x = c2f("c:\temp\junk.txt", Me!MemoField)
x = c2f("c:\temp\junk02.txt", "hi there" & chr(13) & "hello")

function c2f (cFile as string, cContent as string) as boolean
Dim FileNumber as Integer
Filenumber = FreeFile
Open cFile for Append as #Filenumber
Write #Filenumber, cContent
Close #Filenumber
end function

--

Remove word NOSPAM from email to reply.

Quote:

>See the "Writing Data to Files" topic in Access's online help.

>Also see the following statement topics:

>Open Statement
>Close Statement
>FileFree Statement
>Print #
>Write #
>Input #
>Line Input #

>Use the Print # statement to write undelimited data.  Use the Write #
>statement to delemit your file.

>Here's an example:

>Dim FileNumber as Integer
>Filenumber = FreeFile
>Open "Drive:\Path\Filename" for Append as #Filenumber
>Write #Filenumber, Me!MemoField
>Close #Filenumber

>More examples are given in online help.

>Regards,
>Glenn Tarpley
>GDTUSA
>Resources for Programmers
>http://www.concentric.net/~Gdtusa/


>>Pardon the cross post, but I really couldn't figure out where this one
>>belonged.

>>If I have some text in a memo or memory variable, how would I write it to
a
>>text file?

>>Thanks in advance!

>>--

>>Remove word NOSPAM from email to reply.



Tue, 17 Jul 2001 03:00:00 GMT  
 Access send data in memo to text file
Darcy,

Yes, your understanding is correct.

Use "Open for Output" instead of "Open for Append" if you want to delete an
existing file and create a new one.  For literal string values such as "hi
there" & chr(13) & "hello", it may be better to use the Print # statement
(not delimited) instead of the Write # statement (delimited)--which
statement is appropriate can be determined by how you use the resulting
file.  If you intend to read the file from VBA you may find it easier (or
more appropriate) to read Print # stored values, while other values are more
appropriately read from values stored with the Write # statement.  See the
Line Input, Input #, etc. statements in online help.

If you are not going to read the files from VBA, then for all practical
purposes, you can use Print # statements to format a file's content the same
way it would be displayed in a msgbox or in the debug window--that is
Debug.Print goes to the Debug window and Print # goes to a file.  The
resulting output of both "Prints" can be formatted using tabs, comma zones,
etc.  You can use chr() to add special character punctuation as needed.

Regards,
Glenn Tarpley
GDTUSA
Resources for Programmers
http://www.concentric.net/~Gdtusa/

Quote:

>Glen,
>Thank you for the reply. If I am understanding you correctly, then the
>following function should write a variable to a file:

>dim x
>x = c2f("c:\temp\junk.txt", Me!MemoField)
>x = c2f("c:\temp\junk02.txt", "hi there" & chr(13) & "hello")

>function c2f (cFile as string, cContent as string) as boolean
>Dim FileNumber as Integer
>Filenumber = FreeFile
>Open cFile for Append as #Filenumber
>Write #Filenumber, cContent
>Close #Filenumber
>end function



Tue, 17 Jul 2001 03:00:00 GMT  
 Access send data in memo to text file
Assuming your recordste memo field is MyRs("MyMemo")

Dim Fcontent() as byte
Dim Fnum  as integer
Dim FpathName as string
FpathName = " c:\temp\myfilename"
Fnum = Freefile

Open FpathName for Binary as #fnum
    Redim Fontent(MyRs("MyMemo").fieldsize
    Fcontent = MyRs("MyMemo")
    Put #Fnum,,Fcontent
Close #Fnum

Didn't test the above code but think it should work OK :-)
Should work the same with a variable instead of a field.

Quote:

>Pardon the cross post, but I really couldn't figure out where this one
>belonged.

>If I have some text in a memo or memory variable, how would I write it to a
>text file?

>Thanks in advance!

>--

>Remove word NOSPAM from email to reply.



Wed, 18 Jul 2001 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Problem returning data from a scroll text box to an Access memo field

2. can't access data from text file use Data control

3. How do I send list box data to a text file

4. sending form data to text file on local drive

5. sending files in a memo using ado

6. Text or Memo fields refuse to accept data

7. SQL Searching For Text in Memo Fields with Binary Data Included

8. How to FULL JUSTIFY TEXT of a MEMO FIELD in access reports

9. vb text control & access memo field

10. Reporting Rich Text in Memo Field in MS Access

11. Reporting Rich Text in Memo Field in MS Access

12. Entering vast amont of text into memo-field of access-database (on server)

 

 
Powered by phpBB® Forum Software