[AccessD] Tab delimited text file

Stuart McLachlan stuart at lexacorp.com.pg
Thu Oct 27 15:19:43 CDT 2011


And here's a DAO version I've quickly knocked up (not tested):

Function ExportTab(RSName As String, FileName As String) As Boolean
Dim rs As DAO.Recordset
Dim ff As Long
Dim x As Long
Dim strtemp As String
On Error GoTo errtrap
ff = FreeFile
Set rs = CurrentDb.OpenRecordset(RSName)
Open FileName For Output As #ff
While Not rs.EOF
    strtemp = rs(0)
    For x = 1 To rs.Fields.Count - 1
      strtemp = strTemp & vbTab & rs(x) 
    Next
    strtemp = strtemp & vbCrLf
    Print #ff, strtemp
    rs.MoveNext
Wend
Close #ff
rs.Close
Set rs = Nothing
ExportTab = True
Exit Function
errtrap:
MsgBox "Error: " & Err.Description & " in Function ExportTab()"
End Function

On 27 Oct 2011 at 15:06, Paul Hartland wrote:

> Here is a little function I have quickly knocked together, can't find
> my source, but no reason why it shouldn't work, you pass a recordset
> to function to export, could also pass the export path name as well if
> you wanted:





More information about the AccessD mailing list