Want to create text file through code

S

Saleem

I wana create text files base on user queries
If some have any codes or help to make this easy.
I will be greatfull to them.
 
S

Stefan Hoffmann

hi,
I wana create text files base on user queries
If some have any codes or help to make this easy.
Take a look at the

DoCmd.TransferText

method in the online help.



mfG
--> stefan <--
 
A

Arvin Meyer [MVP]

Saleem said:
I wana create text files base on user queries
If some have any codes or help to make this easy.
I will be greatfull to them.

In addition to Stephan's reply, you can also use basic I/O code like the
following which writes an error log:

Public Function ErrorLog(objName As String, routineName As String)
Dim db As Database

Set db = CurrentDb

Open "C:\Error.log" For Append As #1

Print #1, Format(Now, "mm/dd/yyyy, hh:nn:ss") & ", " & db.Name & _
"An error occured in " & objName & ", " & routineName & _
", " & CurrentUser() & ", Error#: " & Err.Number & ", " &
Err.Description

Close #1
End Function

By looping throught your query you can write your records exactly the way
you want them, with complete control. Using TransferText as Stephan suggests
is both faster and easier if you don't need the extra control.
 
Top