Hi every one
this is very simple but i could not find the solution.
There are two tables: Assets and SoldAssets
I am trying to generate a report using these tables which contains two Calculating field namely Capital Gain & Capital Loss. For a particular record if CapitalGain is +ve then Capital Loss is -ve. What i want is that a particular record should contain only Capital Gain or CapitalLoss and not both. how to do it? Can any help me?
here is the sql statement:
SELECT Departments.Department, [Asset Categories].AssetCategory, Assets.AssetID, Assets.DateAcquired, Assets.AssetDescription, Assets.AcquiredQuantity, Assets.AcquiredPrice, SoldAssets.DateSold, SoldAssets.SoldQuantity, SoldAssets.SoldValue, [SoldAssets]![SoldValue]-[SoldAssets]![SoldQuantity]*[Assets]![AcquiredPrice]/[Assets]![AcquiredQuantity] AS CapitalGain, Departments.DepartmentID, [SoldAssets]![SoldQuantity]*[Assets]![AcquiredPrice]/[Assets]![AcquiredQuantity]-[SoldAssets]![SoldValue] AS CapitalLoss
FROM (Departments INNER JOIN ([Asset Categories] INNER JOIN Assets ON [Asset Categories].AssetCategoryID = Assets.AssetCategoryID) ON Departments.DepartmentID = Assets.DepartmentID) LEFT JOIN SoldAssets ON Assets.AssetID = SoldAssets.AssetID
WHERE (((Assets.DateAcquired) Between [Forms]![Report Range]![Beginning Date Range] And [Forms]![Report Range]![Ending Date Range]));
thanks
sunil
this is very simple but i could not find the solution.
There are two tables: Assets and SoldAssets
I am trying to generate a report using these tables which contains two Calculating field namely Capital Gain & Capital Loss. For a particular record if CapitalGain is +ve then Capital Loss is -ve. What i want is that a particular record should contain only Capital Gain or CapitalLoss and not both. how to do it? Can any help me?
here is the sql statement:
SELECT Departments.Department, [Asset Categories].AssetCategory, Assets.AssetID, Assets.DateAcquired, Assets.AssetDescription, Assets.AcquiredQuantity, Assets.AcquiredPrice, SoldAssets.DateSold, SoldAssets.SoldQuantity, SoldAssets.SoldValue, [SoldAssets]![SoldValue]-[SoldAssets]![SoldQuantity]*[Assets]![AcquiredPrice]/[Assets]![AcquiredQuantity] AS CapitalGain, Departments.DepartmentID, [SoldAssets]![SoldQuantity]*[Assets]![AcquiredPrice]/[Assets]![AcquiredQuantity]-[SoldAssets]![SoldValue] AS CapitalLoss
FROM (Departments INNER JOIN ([Asset Categories] INNER JOIN Assets ON [Asset Categories].AssetCategoryID = Assets.AssetCategoryID) ON Departments.DepartmentID = Assets.DepartmentID) LEFT JOIN SoldAssets ON Assets.AssetID = SoldAssets.AssetID
WHERE (((Assets.DateAcquired) Between [Forms]![Report Range]![Beginning Date Range] And [Forms]![Report Range]![Ending Date Range]));
thanks
sunil