Low Level Text File Printing

G

GeyikBaba

I am using Access 2003, VBA, and am trying to create a comma delimited text
file.

I am having a problem with a CF + LF put at the end of each print command.
Because I have a lot of fields, I need to break each line up into several
PRINT statements. Since Print ends with the CF+LF character , each line is
being broken up into several lines.

Can I prevent Print from appending a CF+LF? Is there another command which
does not append CF+LF?

An example is below. It should be one line, but it is coming out as two.

Thanks
Mike Thomas

strLine = "The first part of the line -- "
Print #filenumber, strLine

strLine = "the second half of the same line"
Print #filenumber, strLine
 
D

Douglas J. Steele

Is there some reason you can't concatenate the string before you write it
out?

I seem to recall that if you put a comma (or is it semi-colon?) at the send
of the Print line, it doesn't put in the Cr/Lf, but I can't guarantee it.
 
G

GeyikBaba

Doug, many thanks. A comma at the end inserts about 5 spaces, a semi colon
inserts none. I used semi colon.

I do not want to concantenate all columns. There are over 100. I would run
into a too many continuations error, or the line would go so far to the
right it would be impossible to read.

Many thanks
Mike Thomas
 
D

Douglas J. Steele

strLine = "The first part of the line -- "
strLine = strLine & "the second part of the same line "
strLine = strLine & "the third part of the same line "
strLine = strLine & "the fourth part of the same line "
 
G

GeyikBaba

Doug,

Do you know how many characters a string can contain?

Thanks,
Mike Thomas
 
D

Douglas J. Steele

From the Help file:

There are two kinds of strings: variable-length and fixed-length strings.

· A variable-length string can contain up to approximately 2 billion (2^31)
characters.
· A fixed-length string can contain 1 to approximately 64K (2^16)
characters.
 
G

GeyikBaba

Many thaks Doug - I think I can get under that limit. I was thinking that
the max number of chars in a string was 1023, which would be a little dicey.

Mike Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top