RJGoodhead
Registered User.
- Local time
- Today, 12:38
- Joined
- Feb 16, 2012
- Messages
- 14
I've created a query using design view in Access 2011. Part of it has 2 expressions (Sales and Cost) that i then need to find the difference of. I have done this with a third expression, GrossProfit.
For some reason when running the query Access prompts for the value of Sales and Cost, but in the final datasheet the values are correctly calculated
Any thoughts please?
SQL below, have separated and highlighted the 3 expressions
For some reason when running the query Access prompts for the value of Sales and Cost, but in the final datasheet the values are correctly calculated
Any thoughts please?
SQL below, have separated and highlighted the 3 expressions
Code:
SELECT OrdersTable.InvoiceDate, OrdersTable.InvoiceNumber, OrdersTable.OrderNumber, OrdersTable.CustomerName,
OrdersTable.CostCentre, SerialTable.Model, SerialTable.SerialNumber,
[COLOR=red]Nz([OrdersTable].[TotalInvoiceValue])*[OrdersTable].[ExchangeRate] AS Sales,[/COLOR]
[COLOR=red]Nz(Sum([AtchdInvoicesTable].[DollarValue])+(Nz([OrdersTable].[CustomerProvision])+[/COLOR]
[COLOR=red]Nz([OrdersTable].[SpaProvision]))*[OrdersTable].[ExchangeRate]) AS Cost,[/COLOR]
[COLOR=red][Sales]-[Cost] AS GrossProfit,[/COLOR]
OrdersTable.TerritoryCode, OrdersTable.CustomerProvision, OrdersTable.SpaProvision, OrdersTable.ExchangeRate
FROM (OrdersTable INNER JOIN AtchdInvoicesTable ON OrdersTable.OrderNumber = AtchdInvoicesTable.OrderNumber)
INNER JOIN SerialTable ON OrdersTable.OrderNumber = SerialTable.OrderNumber
GROUP BY OrdersTable.InvoiceDate, OrdersTable.InvoiceNumber, OrdersTable.OrderNumber,
OrdersTable.CustomerName, OrdersTable.CostCentre, SerialTable.Model, SerialTable.SerialNumber,
Nz([OrdersTable].[TotalInvoiceValue])*[OrdersTable].[ExchangeRate], [Sales]-[Cost],
OrdersTable.TerritoryCode, OrdersTable.CustomerProvision, OrdersTable.SpaProvision,
OrdersTable.ExchangeRate;