By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,449 Members | 921 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,449 IT Pros & Developers. It's quick & easy.

Put Data Into Text File

P: n/a
When using

Do until rst.eof
Put #filename, , rst!somedata
rst.movenext
Loop

I would like to create a new line for each item written into the text file.
Is there are character I can concatenate onto the back end of the string I
am writing to the txt file ?
Or is their a verison of Put that also does NewLine ??
Nov 13 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Michael Wiseley wrote:
When using

Do until rst.eof
Put #filename, , rst!somedata
rst.movenext
Loop

I would like to create a new line for each item written
into the text
file. Is there are character I can concatenate onto the
back end of
the string I am writing to the txt file ?
Or is their a verison of Put that also does NewLine ??


A new line in Windows is Carriage Return and Line Feed
character pair.

In Access VBA (and VB) concatenate 'vbCrLf' to the end of
your line's worth of text.

--
Nick Coe (UK)
AccHelp v1.01 Access Application Help File Builder
http://www.alphacos.co.uk/
Download Free Copy
----
Nov 13 '05 #2

P: n/a
Or you can use: & vbNewline

*David*

"Nick Coe (UK)" <cl*****************@MASPON.yahooDOTcom> wrote in message
news:41***********************@ptn-nntp-reader03.plus.net...
Michael Wiseley wrote:
When using

Do until rst.eof
Put #filename, , rst!somedata
rst.movenext
Loop

I would like to create a new line for each item written
into the text
file. Is there are character I can concatenate onto the
back end of
the string I am writing to the txt file ?
Or is their a verison of Put that also does NewLine ??


A new line in Windows is Carriage Return and Line Feed
character pair.

In Access VBA (and VB) concatenate 'vbCrLf' to the end of
your line's worth of text.

--
Nick Coe (UK)
AccHelp v1.01 Access Application Help File Builder
http://www.alphacos.co.uk/
Download Free Copy
----

Nov 13 '05 #3

P: n/a
Am I missing something here? I've never used "Put" before.

How about:

Do until rst.eof
Print #filename, , rst!somedata
rst.movenext
Loop

The "Print" will automatically send the CrLf.

Scott
"Michael Wiseley" <mi**********@gte.net> wrote in message
news:xayrd.6727$wr6.1175@trnddc04...
When using

Do until rst.eof
Put #filename, , rst!somedata
rst.movenext
Loop

I would like to create a new line for each item written into the text
file.
Is there are character I can concatenate onto the back end of the string I
am writing to the txt file ?
Or is their a verison of Put that also does NewLine ??

Nov 13 '05 #4

P: n/a
Thanks. I had never used print before but it works fine. I was trying to use
the put command (after opening a binary type file) to write a string of text
and HTML tags. Then I would rename the file as filename.html.
Using the print statement (and not using binary file type) will make the
HTML code format better when viewing the source code behind the browser.

"Scott Simonson" <sc***********@wi.rr.com> wrote in message
news:rt********************@twister.rdc-kc.rr.com...
Am I missing something here? I've never used "Put" before.

How about:

Do until rst.eof
Print #filename, , rst!somedata
rst.movenext
Loop

The "Print" will automatically send the CrLf.

Scott
"Michael Wiseley" <mi**********@gte.net> wrote in message
news:xayrd.6727$wr6.1175@trnddc04...
When using

Do until rst.eof
Put #filename, , rst!somedata
rst.movenext
Loop

I would like to create a new line for each item written into the text
file.
Is there are character I can concatenate onto the back end of the string I am writing to the txt file ?
Or is their a verison of Put that also does NewLine ??


Nov 13 '05 #5

P: n/a
I have a newbie question. Using VBA how do I open an INI file and
change the "LastDir=" line, shown below, to a new location then save
the file. I want to do this all in the backgroud before I run a
picture organizer application(from a command button on a form) that
will access the new location in the INI file.

Bottom Width=304
Bottom Height=0
[Main]
HideOnClose=0
LastDir=C:\Pictures\SmithJohn2
LastWorkDir=
LastAction=0
ViewStyle=0
Orientation=0

Thanks in advance.

"Michael Wiseley" <mi**********@gte.net> wrote in message news:<xayrd.6727$wr6.1175@trnddc04>...
When using

Do until rst.eof
Put #filename, , rst!somedata
rst.movenext
Loop

I would like to create a new line for each item written into the text file.
Is there are character I can concatenate onto the back end of the string I
am writing to the txt file ?
Or is their a verison of Put that also does NewLine ??

Nov 13 '05 #6

P: n/a
This isn't homework, is it?

I would read each line with " Line Input #infile, buff ". Do a "
Search("LastDir=",buff) ". Write out each line to a different file with "
Print #outfile, buff ". Delete the old file and rename the just outputted
file.

HTH

Scott
"bborden" <bb*******@gmail.com> wrote in message
news:ea**************************@posting.google.c om...
I have a newbie question. Using VBA how do I open an INI file and
change the "LastDir=" line, shown below, to a new location then save
the file. I want to do this all in the backgroud before I run a
picture organizer application(from a command button on a form) that
will access the new location in the INI file.

Bottom Width=304
Bottom Height=0
[Main]
HideOnClose=0
LastDir=C:\Pictures\SmithJohn2
LastWorkDir=
LastAction=0
ViewStyle=0
Orientation=0

Thanks in advance.

"Michael Wiseley" <mi**********@gte.net> wrote in message
news:<xayrd.6727$wr6.1175@trnddc04>...
When using

Do until rst.eof
Put #filename, , rst!somedata
rst.movenext
Loop

I would like to create a new line for each item written into the text
file.
Is there are character I can concatenate onto the back end of the string
I
am writing to the txt file ?
Or is their a verison of Put that also does NewLine ??

Nov 13 '05 #7

P: n/a
An INI file is a bit more than just a text file... there are system INIs and
private INIs, but basically these are "leftovers" from 16-bit Windows.
32-bit Windows uses the Registry for similar purposes -- a great improvement
in the eyes of some, not an improvement at all in the eyes of others. There
are Windows APIs for dealing with INI files, that are preferrable to just
working on them as though they were normal text, although they can be
read/written as normal text files. To learn about the APIs, I'd start
searching at the FAQ site, http://www.mvps.org/access, then if I didn't find
what I was looking for, I'd go to the base URL of http://www.mvps.org and
look for sites offering VB assistance -- one that is very good in such areas
is VB MVP Randy Birch's site. I'd look at http://support.microsoft.com to
search the Knowledge Base and http://office.microsoft.com.

Larry Linson
Microsoft Access MVP

"bborden" <bb*******@gmail.com> wrote in message
news:ea**************************@posting.google.c om...
I have a newbie question. Using VBA how do I open an INI file and
change the "LastDir=" line, shown below, to a new location then save
the file. I want to do this all in the backgroud before I run a
picture organizer application(from a command button on a form) that
will access the new location in the INI file.

Bottom Width=304
Bottom Height=0
[Main]
HideOnClose=0
LastDir=C:\Pictures\SmithJohn2
LastWorkDir=
LastAction=0
ViewStyle=0
Orientation=0

Thanks in advance.

"Michael Wiseley" <mi**********@gte.net> wrote in message

news:<xayrd.6727$wr6.1175@trnddc04>...
When using

Do until rst.eof
Put #filename, , rst!somedata
rst.movenext
Loop

I would like to create a new line for each item written into the text file. Is there are character I can concatenate onto the back end of the string I am writing to the txt file ?
Or is their a verison of Put that also does NewLine ??

Nov 13 '05 #8

P: n/a

bborden wrote:
I have a newbie question. Using VBA how do I open an INI file and
change the "LastDir=" line, shown below, to a new location then save
the file. I want to do this all in the backgroud before I run a
picture organizer application(from a command button on a form) that
will access the new location in the INI file.

Bottom Width=304
Bottom Height=0
[Main]
HideOnClose=0
LastDir=C:\Pictures\SmithJohn2
LastWorkDir=
LastAction=0
ViewStyle=0
Orientation=0

Thanks in advance.

"Michael Wiseley" <mi**********@gte.net> wrote in message

news:<xayrd.6727$wr6.1175@trnddc04>...
When using

Do until rst.eof
Put #filename, , rst!somedata
rst.movenext
Loop

I would like to create a new line for each item written into the text file. Is there are character I can concatenate onto the back end of the string I am writing to the txt file ?
Or is their a verison of Put that also does NewLine ??


Nov 13 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.