How to write text file

S

SF

Hi,

How to wrote a field (memo) content to a text file. Before write to text
file I want to remove the <div> ,</div>. How to do that?

SF
 
O

Ordi maison

SF said:
Hi,

How to wrote a field (memo) content to a text file. Before write to text
file I want to remove the <div> ,</div>. How to do that?

SF
parler francais ou espagnol
 
T

Tom Wickerath

Hi SF,

Are you using Access 2007, with the .accdb file format, and a rich text
formatted memo field? The reason I ask is your mention of <div> and </div>
tags. Here is one method that I think will work, but I only tested it using
Access 2003:

Create a new query that includes your memo field. Here is an example for the
sample Northwind database, using the Employees table and the Notes field:

SELECT Trim(Replace(Replace([Notes],"<div>",""),"</div>","")) AS NewNotes
FROM Employees;

You can then export the query to a text file. In Access 2003, you would use
File | Export. Alternatively, you can create a new stand-alone module, and
paste in the following function:

Option Compare Database
Option Explicit

Sub WriteMemo()
On Error GoTo ProcError

DoCmd.TransferText TransferType:=acExportDelim, _
TableName:="qryMemoExport", _
filename:=CurrentProject.Path & "\Memo.txt", _
HasFieldNames:=True

MsgBox "Done.", vbInformation, "Memo Field Exported..."

ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in procedure WriteMemo..."
Resume ExitProc

End Sub

'------------------------------------------------

Save the module as basMemoExport. Now try running the WriteMemo subroutine,
by having your cursor anywhere within this procedure and then pressing the F5
key.


Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
__________________________________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top