Thank you that works well.
I also found this code
Code:
Public Type NameofRecord
VarRecordFormat As String * 5
VarBillingInvoicingParty As String * 4
VarBilledParty As String * 4
End Type
Public Sub OutputTextfile()
Dim rs As DAO.Recordset
Dim objFile As Object, TextFile As Object
Dim TextRecord As NameofRecord
Set rs = CurrentDb.OpenRecordset("q_500ByteExport")
Set objFile = CreateObject("Scripting.FileSystemObject")
Set TextFile = objFile.CreateTextFile("C:\tmp\export.txt", True)
Do Until rs.EOF
With TextRecord
.VarRecordFormat = CStr(rs![RecordFormat])
.VarBillingInvoicingParty = CStr(rs![BillingInvoicingParty])
.VarBilledParty = CStr(rs![BilledParty])
TextFile.WriteLine (.VarRecordFormat & .VarBillingInvoicingParty & .VarBilledParty)
End With
rs.MoveNext
Loop
rs.Close
TextFile.Close
End Sub
It works like I want but the problem is that if there is a null value in any of the fields it does not work. Does anyone know how to get this to work with null fields?
Thanks