Hi, I have this code to create a csv file
[red]Below is the query in Access... The field in BOLD/RED is a bank sort code, it is a text field in the employee table, HOWEVER, in the csv file, its changed to a date!!!
How do I make that stay as general and display as per table e.g. 10-10-10???[/red]
[blue]The other question, a telephone number, e.g displays as 079.. BUT the leading 0 is omitted, is it possible to keep this???[/blue]
SELECT tblEmployee.EmpNo, tblEmployee.EmpNo AS WkRef, tblEmployeeLookupTitle.EmpTitle, tblEmployee.EmpInitials, tblEmployee.EmpForename, tblEmployee.EmpSurname, tblEmployee.EmpAddress1, tblEmployee.EmpAddress2, tblEmployee.EmpAddress3, tblEmployee.EmpAddressArea, tblEmployee.EmpAddressTown, tblEmployee.EmpAddressPostCode, Null AS Email, [blue]tblEmployee.EmpMobileNo,[/blue] tblEmployee.EmpGender, tblEmployee.EmpMaritalStatus, tblEmployee.EmpDateOfBirth, tblEmployee.EmpCommencementDate, Null AS EndDt, tblEmployee.EmpNationalInsuranceNo, tblEmployee.EmpNIcategory, tblEmployee.EmpTaxCode, 0 AS Wk1, Null AS Pen1, Null AS Pen2, Null AS Pen3, Null AS Pen4, Null AS Pen5, "BACS" AS PayMent, tblEmployee.EmpPaymentFrequency, Null AS GS, Null AS CH, Null AS AL, Null AS DS, Null AS Ddt, Null AS Notes, Null AS Cont, Null AS Crel, Null AS Ctel, Null AS Null1, Null AS Null2, [red]tblEmployee.EmpBankSortCode,[/red] tblEmployee.EmpBankAccountNo, tblEmployee.EmpAccountHolderName, Null AS BaccT, Null AS BldSocNo, tblEmployee.EmpBuildingSocietyRef, tblEmployee.EmpBankName
FROM tblEmployeeLookupTitle RIGHT JOIN tblEmployee ON tblEmployeeLookupTitle.EmpTitleID = tblEmployee.EmpTitle
WHERE (((tblEmployee.EmpRegNo)=3617))
ORDER BY tblEmployee.EmpNo;
Thx
Darin
Code:
Private Sub cmdTestCSV_Click()
Dim StrFile
StrFile = "\\Lynxserver\lynx\test" & ".csv"
DoCmd.TransferText acExportDelim, , "SAGE EmployeeDetailsTemplate", StrFile, False
End Sub
[red]Below is the query in Access... The field in BOLD/RED is a bank sort code, it is a text field in the employee table, HOWEVER, in the csv file, its changed to a date!!!
How do I make that stay as general and display as per table e.g. 10-10-10???[/red]
[blue]The other question, a telephone number, e.g displays as 079.. BUT the leading 0 is omitted, is it possible to keep this???[/blue]
SELECT tblEmployee.EmpNo, tblEmployee.EmpNo AS WkRef, tblEmployeeLookupTitle.EmpTitle, tblEmployee.EmpInitials, tblEmployee.EmpForename, tblEmployee.EmpSurname, tblEmployee.EmpAddress1, tblEmployee.EmpAddress2, tblEmployee.EmpAddress3, tblEmployee.EmpAddressArea, tblEmployee.EmpAddressTown, tblEmployee.EmpAddressPostCode, Null AS Email, [blue]tblEmployee.EmpMobileNo,[/blue] tblEmployee.EmpGender, tblEmployee.EmpMaritalStatus, tblEmployee.EmpDateOfBirth, tblEmployee.EmpCommencementDate, Null AS EndDt, tblEmployee.EmpNationalInsuranceNo, tblEmployee.EmpNIcategory, tblEmployee.EmpTaxCode, 0 AS Wk1, Null AS Pen1, Null AS Pen2, Null AS Pen3, Null AS Pen4, Null AS Pen5, "BACS" AS PayMent, tblEmployee.EmpPaymentFrequency, Null AS GS, Null AS CH, Null AS AL, Null AS DS, Null AS Ddt, Null AS Notes, Null AS Cont, Null AS Crel, Null AS Ctel, Null AS Null1, Null AS Null2, [red]tblEmployee.EmpBankSortCode,[/red] tblEmployee.EmpBankAccountNo, tblEmployee.EmpAccountHolderName, Null AS BaccT, Null AS BldSocNo, tblEmployee.EmpBuildingSocietyRef, tblEmployee.EmpBankName
FROM tblEmployeeLookupTitle RIGHT JOIN tblEmployee ON tblEmployeeLookupTitle.EmpTitleID = tblEmployee.EmpTitle
WHERE (((tblEmployee.EmpRegNo)=3617))
ORDER BY tblEmployee.EmpNo;
Thx
Darin