I have a Union Query which I want to add calculated field
Using the above code when running the query I have the pop up window TOT (beacuase I don't have the column TOT in tblPayslip) that I can click OK
and then it runs the query with the correct result.
In order to avoid the pop up window I changed the code to:
As a result I get some weird characters
Changing the code to
I get the below which again is wrong as it adds TOT to the last 2 records
What should I do?
Code:
SELECT TransactionDate, PensionEmployee, PensionEmployer, TransactionType, FundName, Payments, UnitsTransaction, TOT
FROM tblPension
UNION
SELECT PayslipDate, PensionEmployee, PensionEmployer, Null As Col4, Null As Col5, Null As Col6, Null As Col7, Abs([PensionEmployee]-[PensionEmployer]) AS TOTAL
FROM tblPayslip;
and then it runs the query with the correct result.
In order to avoid the pop up window I changed the code to:
Code:
SELECT TransactionDate, PensionEmployee, PensionEmployer, TransactionType, FundName, Payments, UnitsTransaction, Null As TOT
FROM tblPension
UNION
SELECT PayslipDate, PensionEmployee, PensionEmployer, Null As Col4, Null As Col5, Null As Col6, Null As Col7, Abs([PensionEmployee]-[PensionEmployer]) AS TOTAL
FROM tblPayslip;
As a result I get some weird characters
Changing the code to
Code:
SELECT TransactionDate, PensionEmployee, PensionEmployer, TransactionType, FundName, Payments, UnitsTransaction, "TOT"
FROM tblPension
UNION
SELECT PayslipDate, PensionEmployee, PensionEmployer, Null As Col4, Null As Col5, Null As Col6, Null As Col7, Abs([PensionEmployee]-[PensionEmployer]) AS TOTAL
FROM tblPayslip;
I get the below which again is wrong as it adds TOT to the last 2 records
What should I do?