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
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