Want to create text file through code

  • Thread starter Thread starter Saleem
  • Start date Start date
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.
 
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 <--
 
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.
 

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