Re: Export Text File consisting header and table
- From: Tim Ferguson <FergusonTG@xxxxxxxxxxxx>
- Date: Mon, 29 Aug 2005 06:04:03 -0700
=?Utf-8?B?TkMgQmVhY2ggQnVt?= <NCBeachBum@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote in news:A0A31AA8-2376-4DEA-827D-37544289B174@xxxxxxxxxxxxx:
> Frist line is a header record such as "this is the header".
> The second line then contains the rows of a data table in a specific
> set number of characters with a filler at the end to make a full 80
> character record.
It's not very hard:
open FileName for output as #OutFileH
print #outfile, "This is the header"
do while not rst.EOF
print #outfile, padright(rst!First, 18));
print #outfile, padright(rst!Second, 12));
print #outfile, padright(rst!Third, 9));
' finished row
print #outfile
rst.movenext
loop
close #outfile
rst.Close
Oh yes, you'll need something like this too:
public function padright(Something as variant, PadWidth as integer) _
as string
dim temp as string
if not isnull(something) then
' standard right-padding algorithm
' use default data type conversion: should really be a lot
' more defensive e.g. with decimal points, date formats,
' booleans etc etc etc.
temp = Right(space(padwidth) & CStr(Something), PadWidth)
else
temp = Str(padwidth,"*")
end if
padright = temp
end function
Hope that helps
.
- References:
- Export Text File consisting header and table
- From: NC Beach Bum
- Export Text File consisting header and table
- Prev by Date: Re: me.undo
- Next by Date: Re: addnew results in "invalid use of null" message
- Previous by thread: Export Text File consisting header and table
- Next by thread: How do I automatically open a form linked to the current record?
- Index(es):
Relevant Pages
|