I am using the acExportDelim to export a table into a
delimited txt file format.
Here it's the codes:
Private Sub cbxTEC_DblClick(Cancel As Integer)
On Error GoTo Error_cbxTEC_DblClick
stFL = Me!txtFLoc 'File Location
stQDA = "qdelACH" 'Delete Query for ACH
stQDB = "qdelWires" 'Delete Query for Wires
With Me.lblES
.Visible = True
.Caption = "TEC Export Status"
End With
With Me.ocxProgBar
.Visible = True
.Value = 20
End With
Me.Repaint
DoCmd.SetWarnings False
DoCmd.Hourglass True
DoCmd.OpenQuery stQDA, acViewNormal, acEdit
Me.ocxProgBar.Value = 30
DoCmd.OpenQuery "qryaExportTECACH", acNormal, acEdit
Me.ocxProgBar.Value = 40
DoCmd.TransferText
acExportDelim, "TECExport", "tblACHExport", stFL
& "TECACH.TXT", False, ""
Me.ocxProgBar.Value = 50
' Change the value of all TEC ACH items to Exported Yes
DoCmd.OpenQuery "qryuTECACHExported", acNormal,
acReadOnly
Me.ocxProgBar.Value = 60
DoCmd.OpenQuery stQDB, acViewNormal, acEdit
Me.ocxProgBar.Value = 70
DoCmd.OpenQuery "qryaExportTECBatchWire", acNormal,
acEdit
Me.ocxProgBar.Value = 80
DoCmd.TransferText
acExportDelim, "TECExport", "tblBWExport", stFL
& "TECBW.TXT", False, ""
Me.ocxProgBar.Value = 90
' Change the value of all TEC Batch Wire items to
Exported Yes
DoCmd.OpenQuery "qryuTECBatchWireExported", acNormal,
acReadOnly
Me.ocxProgBar.Value = 100
Forms!fmnuExportsSwitchboard!cbxTEC = 0
Exit_cbxTEC_DblClick:
With Me.lblES
.Caption = "Export Status"
.Visible = False
End With
Me.ocxProgBar.Visible = False
DoCmd.SetWarnings True
DoCmd.Hourglass False
Exit Sub
Error_cbxTEC_DblClick:
MsgBox Err.Number & ": " & Err.Description
Resume Exit_cbxTEC_DblClick
End Sub