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

USING PRINT#1 TO WRITE TO FILE 1

Status
Not open for further replies.

Jean9

Programmer
Dec 6, 2004
128
US
I am using the following code to write the contents of 4 tables to a single text file columns delimited by commas. I am using vbcrlf to delimit the rows. However, there is a blank row in the file between tables when the code has completed. How do I write the code so that between the tables in the text file there are no vbcrlfs resulting in blank rows?
Thanks,
J9

Public Function ProcessExpFile()
Dim sFILENM As String

' Close the text file if it is open from previous code runs
Close #1

sFILENM = "C:\OUTPUT\AP019.txt"
' Open text file for writing
Open sFILENM For Output As #1
Set RS_ADO = New ADODB.Recordset
' Open the tables and write the records to the text file
RS_ADO.Open "H", CurrentProject.Connection
WriteFile
RS_ADO.Open "V", CurrentProject.Connection
WriteFile
RS_ADO.Open "W", CurrentProject.Connection
WriteFile
RS_ADO.Open "D", CurrentProject.Connection
WriteFile
' Close the text file
Close #1

End Function

Public Function WriteFile()

' Write table data to string format
vDATA = RS_ADO.GetString(adClipString, , Chr(44), vbCrLf)
' Debug.Print vDATA
' Write string to text file
Print #1, vDATA
' Close recordset to prepare to open next recordset
RS_ADO.Close

End Function
 
You may try this:
Print #1, vDATA[!];[/!]

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top