SELECT [Building information].[Building name], [Utility meter data].[Account number], [Electrical Monthly utility].[Date from], [Electrical Monthly utility].[Date to], IIf([Days 'to' passed]>[Days 'from' to end],[Month to],[Month from]) AS [Utility month], [DAte to]-[Date from] AS [Number of billing days], [Electrical Monthly utility].[Total kWh], [Electrical Monthly utility].Demand, [Electrical Monthly utility].[Utility cost], [Electrical Monthly utility].[Utility discount], [Electrical Monthly utility].[Third party cost], [Utility cost]-[Utility discount]+[Third party cost] AS [Total cost], Month([date from]) AS [Month from], Month([date to]) AS [Month to], Day(DateSerial(Year([Date from]),Month([Date from])+1,0)) AS [Days in the from month], Day(DateSerial(Year([Date to]),Month([Date to])+1,0)) AS [Days in the to month], Day([Date from]) AS [Days 'from' passed], [Days in the from month]-Day([date from]) AS [Days 'from' to end], [Days in the to month]-Day([date to]) AS [Days 'to' to end], Day([date to]) AS [Days 'to' passed], IIf([Month from]=[Month to],(([Total cost]/([Number of billing days]))*[Days 'from' passed])+(([Total cost]/([Number of billing days]))*([Days 'to' passed])),([Total cost]/[Number of billing days])*[Days 'from' to end])+(([Total cost]/([Number of billing days]-1))*[Days 'from' passed]) AS [Adjusted value], IIf([Days 'to' passed]>[Days 'from' passed],([Total cost]/[Number of billing days])*[Days in the to month],([Total cost]/[Number of billing days]*[Days in the from month])) AS [Real Adjusted value]
FROM (([Building information] INNER JOIN [Electrical Monthly utility] ON [Building information].[Contract number] = [Electrical Monthly utility].[Building name]) INNER JOIN [Utility meter data] ON [Building information].[Contract number] = [Utility meter data].[Building name]) INNER JOIN [Electrical Billing profile] ON ([Building information].[Contract number] = [Electrical Billing profile].Building) AND ([Utility meter data].[Meter ID] = [Electrical Billing profile].[Account #]);
I basicaly want to lookup all the values for the Utility month only.