Creating a file by any extension

  • Thread starter Thread starter PJ
  • Start date Start date
P

PJ

Hi All,

Could you please give me some direction as to how i can use access vba to
create a file, lets say a simple text file with a simple string in it?
Thanks in advance.

PJ
 
Paul,
the question is fairly general - I feel restricted to a very general answer.
Create a new table with one field of type text.
Use a form with a text box where user can type in the text.
Export the table using TransferText (vba help explains how).

Here is an example for a table called ExternalReport, saving the text file
as April.txt

DoCmd.TransferText acExportDelim, , "ExternalReport",
"C:\Txtfiles\April.txt"

If you want to choose which text record to export, you would need another
field or fields in the table that would let you choose the correct text
string to export.

Jeanette Cunningham
 
This also works:


Open "C:\TDDOS.txt" For Output As #1
Print #1, Me.cmbEmployee
Close #1


The above creates/overwrites a txt file on the C drive that will
contain 1 record and 1 field containing the value that was in
me.cmbEmployee.


on the Print line comma between fields and one record per print
Can be opened as output, input, append


Ron
 

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

Back
Top