ilfocorp
asked on
Transfertext Header Rows
Hello, I am creating a text file from a table using the following vba script but the field names/headers are not included. Is there a way to include the headers in a transfertext. I have them included in my SPEC. Thank you.
ic
SCRIPT:
Private Sub cmdFileExp_Click()
Dim sysdat As Variant, mo As Variant, da As Variant, yyyy As Variant
Dim fname As Variant, fexist As String
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryPeopleReport_Clnup" 'Delete query
DoCmd.OpenQuery "qryPeopleReport_App" 'Append query
sysdat = Now()
mo = Month(sysdat)
da = Day(sysdat)
yyyy = Year(sysdat)
fname = "H:\HR\BENEFITS\" & "payroll_" & yyyy & "-" & mo & "-" & da & ".txt"
fexist = Dir(fname)
If Len(fexist) <> 0 Then
Kill fname
End If
MsgBox "All People Report information being exported to " & fname & ".", vbOKOnly
DoCmd.TransferText acExportDelim, "qrypeoplerepexp", "tblPeopleReport", fname
MsgBox "export complete.", vbOKOnly
DoCmd.SetWarnings True
End Sub
ic
SCRIPT:
Private Sub cmdFileExp_Click()
Dim sysdat As Variant, mo As Variant, da As Variant, yyyy As Variant
Dim fname As Variant, fexist As String
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryPeopleReport_Clnup" 'Delete query
DoCmd.OpenQuery "qryPeopleReport_App" 'Append query
sysdat = Now()
mo = Month(sysdat)
da = Day(sysdat)
yyyy = Year(sysdat)
fname = "H:\HR\BENEFITS\" & "payroll_" & yyyy & "-" & mo & "-" & da & ".txt"
fexist = Dir(fname)
If Len(fexist) <> 0 Then
Kill fname
End If
MsgBox "All People Report information being exported to " & fname & ".", vbOKOnly
DoCmd.TransferText acExportDelim, "qrypeoplerepexp", "tblPeopleReport", fname
MsgBox "export complete.", vbOKOnly
DoCmd.SetWarnings True
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.