Removing double quotes

C

Chris

I'm using some code to write a memo field to a file. The file is being
created and any quotations int the original memo field are doubled in
teh file. Is there an easy way to fix this or make it not happen?
 
J

John Vinson

I'm using some code to write a memo field to a file. The file is being
created and any quotations int the original memo field are doubled in
teh file. Is there an easy way to fix this or make it not happen?

Care to post the code? There are evidently problems with it, but you
can see the code - we cannot.

John W. Vinson[MVP]
 
C

Chris

I think the problem is that the quotes are stored in the memo field as
doubles.
I got the code from another message board and modified it. It writes
the memo value stored in the memo field perfectly except the fact that
the qutoes are doubled.

Call from main block:
'Get Transform
Set AddinRS = AddinDB.OpenRecordset("cpxml_Transforms",
dbOpenTable)
AddinRS.Index = "PrimaryKey"
AddinRS.Seek "=", Direction

'Write the transform to a temporary file
Dim TransformWritten As Boolean
TransformWritten = cpxml_makefile(TransformFile,
AddinRS.Fields!Transform.Value)

Function cpxml_makefile(cFile As String, cContent As String) As Boolean
Dim FileNumber As Integer

Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile(cFile, True)
a.WriteLine ("")
a.Close

FileNumber = FreeFile
Open cFile For Append As #FileNumber
Write #FileNumber, cContent
Close #FileNumber
'Need to get to return true if it worked
End Function
 
J

John Vinson

TransformWritten = cpxml_makefile(TransformFile,
AddinRS.Fields!Transform.Value)

It would appear that the quotes are being doubled up in the
cbxml_makefile routine.

John W. Vinson[MVP]
 
J

John Vinson

That function was posted above as well. Any idea where it is happening?

Nowhere in the code that you've posted, that I can see!

It's often necessary to convert " to "" in code, if the string being
converted will be used in a VBA string constant delimited by ".
Apparently that's happening in this case.

If all that you want to do is to export a Memo field to a text file, I
wonder if you need all this code. Might just File... Export be
simpler?

John W. Vinson[MVP]
 
C

Chris

Well, i'm not sure why you're not seeing it, but I just changed how I
did the function and used only the OO interface that I was using to
clear the file to write the entre thing (used a.write(cContent) and
that works fine.
 
Top