Discussion Locked

import / export

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
how can i export an ascii text file in MS-access..

5 replies

by rcole

This code sample will give you many options to export to. Put it in the code module of a button and replace the appropriate names with your own.

Private Sub Ctl2F119AToFile_Click()
On Error GoTo Err_Ctl2F119AToFile_Click

DoCmd.OpenForm "Quarterly Utilization Form"
DoCmd.OpenQuery "Quarterly Utilization Temp Storage Update", acViewNormal, acEdit

****DoCmd.OutputTo acReport, "Quarterly Supply Utilization Report" **** This is the one that does the exporting..

DoCmd.CLOSE acForm, "Contract Information", acSaveNo
Call ResetYear

Exit_Ctl2F119AToFile_Click:
Exit Sub

Err_Ctl2F119AToFile_Click:
MsgBox Err.Description
Resume Exit_Ctl2F119AToFile_Click

End Sub

by andrewf

Personally I would use the Transfertext Command

DoCmd.TransferText [transfertype][, specificationname], tablename, filename[, hasfieldnames][, HTMLtablename]

example follows

DoCmd.TransferText acExportDelim, "Standard Output", _
"External Report", "C:\Txtfiles\April.doc"

If you look this up in the help you should find what you want

Andrew Fraser

This discussion is closed to new replies.