I have a table full of data i need to extract and place into a text file. I can do this no worries, but what else is required is to place the extracted data into 2 columns in the text file, this is what i cant work out how to do.
here is what i have below
output is like
i want it to be like this but cant work it out how the list items are varying lengths form about 10 characters to 40 characters and the 2 columns need to be all neatly under each other at the start of each item in both columns like below.
anyone help me out here??
here is what i have below
Code:
Sub CreateBulletinList()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim fso As Object
Dim ts As Object
Set db = CurrentDb
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.CreateTextFile("c:\List.txt", True)
Set rs = db.OpenRecordset("qryBulletinList")
If rs.RecordCount = 0 Then
MsgBox "There is no data at this current time", vbExclamation, "No Records"
Set db = Nothing
Exit Sub
End If
With rs
'writes a heading in the text file
ts.WriteLine DLookup("strText", "tblStrings", "strChecked = TRUE and strGroup = 'YES'")
ts.WriteLine
.MoveFirst
Do While Not .EOF
ts.WriteLine ![dATa]
.MoveNext
Loop
End With
Set rs = Nothing
ts.Close
Set ts = Nothing
Set fso = Nothing
End Sub
output is like
Code:
Heading goes here
list itemmm 1
list itemmmmmm 2
list item 3
list item 4
list item 5
list item 6
i want it to be like this but cant work it out how the list items are varying lengths form about 10 characters to 40 characters and the 2 columns need to be all neatly under each other at the start of each item in both columns like below.
Code:
Heading goes here
list itemmm 1 list item 4
list itemmmmmm 2 list item 5
list item 3 list item 6
anyone help me out here??