[AccessD] Tab delimited text file

Paul Hartland paul.hartland at googlemail.com
Thu Oct 27 09:06:52 CDT 2011


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:

Function ExportTabDelimited(rsExport as Recordset)
Dim strExportPath as String
Dim fnFreeFile

strExportPath = "your path and filename here"

If not rsExport.BOF and not rsExport.EOF Then
rsExport.MoveFirst
Open strExportPath For Output As #fnFreeFile
Do Until rsExport.EOF
Print #fnFileNo, rsExport.GetString(, , vbTab, vbCrLf, "");
rsExport.MoveNext
Loop
Close #fnFreeFile
End If
End Function

On 27 October 2011 14:01, Debbie <delam at zyterra.com> wrote:

> The line by line method is definitely in consideration. I was hoping for
> something that would be a little more friendly to the user who developed
> this db. You never know when someone on this list has the perfect elegant
> solution.
>
> Debbie
>
> Sent from my iPhone
>
> On Oct 27, 2011, at 7:01 AM, Arthur Fuller <fuller.artful at gmail.com>
> wrote:
>
> > That looks like a cleaner solution than my clumsy external method.
> > A.
> >
> > On Thu, Oct 27, 2011 at 7:56 AM, Paul Hartland <
> paul.hartland at googlemail.com
> >> wrote:
> >
> >> Could you not write a function to export the file line by line, put the
> >> file
> >> into a recordset, open a text file for exporting to and loop through the
> >> recordset and print each line into the file using something like
> >>
> >> Print #FileNumber, YourRecordset.GetString(, , vbTab, vbCrLf, "");
> >>
> >> Has worked for me in the past.
> >>
> >>
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> >
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>



-- 
Paul Hartland
paul.hartland at googlemail.com



More information about the AccessD mailing list