Generating a text file

  • Thread starter Thread starter JB_96RS
  • Start date Start date
J

JB_96RS

Hello! I am trying to have Access create a *.csv file for me based upon
a form. Not sure how to go about this. I have the form made with the
fields that I want to be included in the csv file, but I am not sure
how to get the data out into a file.

Thanks,

JB
 
Hello! I am trying to have Access create a *.csv file for me based upon
a form. Not sure how to go about this. I have the form made with the
fields that I want to be included in the csv file, but I am not sure
how to get the data out into a file.

A Form *IS JUST A WINDOW*. It doesn't contain any data, any more than
my office window contains the snowy Treasure Valley.

The data you want to export is in a Table (or tables), the form's
recordsource.

You can use File... Export to export the data from a table or from a
query, but you can't export data from a form.
 
If you're trying to save/export the values in a
particular table or query in a csv-file. You can simply
select the table/query and File-Export, select the
appropriate format and follow the inctructions.
If, on the other hand, you need to create a text file
with the values in your form, you could set a button on
your form. When the button is clicked you can create a
text file.
A textfile is created with a code like this:
Dim textFile, fso
Set fso = CreateObject("Scripting.FileSystemObject")
Set textFile = fso.CreateTextFile("C:\example.txt", True)
textFile.WriteLine ("This is a text file")

hope it helps
Bjorgvin Sigurdsson
 
Back
Top