outputto misery

G

Guest

I created a long expression on a form that outputs xml text. The XML appears
in form view exactly as I want it. My next step is to export the contents of
this field into a txt file. It is important that the output formats exactly
as the text in form view. PROBLEM: using the txt output adds a bunch of
garbage (fieldname, dashes, carriage returns) around the text. Is there any
way to output exactly and only what appears in the form's text box? My code
so far as follows:

'------------------------------------------------------------
' KML_DblClick
'
'------------------------------------------------------------
Private Sub KML_DblClick(Cancel As Integer)
On Error GoTo KML_DblClick_Err

DoCmd.OutputTo acForm, "Form1", "MS-DOSText(*.txt)", "C:\Documents and
Settings\Laptop\Desktop\New Folder\test2.txt", True, ""


KML_DblClick_Exit:
Exit Sub

KML_DblClick_Err:
MsgBox Error$
Resume KML_DblClick_Exit

End Sub
 
W

Wayne Morgan

My help file shows the possible constants for the 3rd argument, where you
have "MS-DOSText(*.txt)", are:
acFormatASP
acFormatDAP
acFormatHTML
acFormatIIS
acFormatRTF
acFormatSNP
acFormatTXT
acFormatXLS

If you use acFormatTXT in the Immediate window, you get back:
MS-DOS Text (*.txt)

I don't know if the spaces will make a difference or not. If that doesn't
fix it, you will probably need to write the file yourself by using the VB
file functions such as:
Write #
Print #
Input
Open
Close
FreeFile
Line Input #
 

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