I have created a table in ms access for calculating shipment charges.
There are 5 fields
1) Weight
2) No_of_pieces
3) Chargeable type (combo box)
4) Rate
5) Total_Price
I have a combo box namely chargeable type if user select chargeable type to A then I want that total price will be calculated by this formula Weight*Rate
And if user select chargeable type to B total price should be calculated by this formula No_of_pieces * Rate.
How to do that ??
Expression in textbox:
=[Rate] * IIf([chargeable type]="A", [Weight], [No_of_pieces])
Related
I have a table in which a certain column's data is sometimes missing, in which cases has just a dash.
But since there's another column which is unique, the missing data can be deduced from other rows.
In other words, I have something like this:
Unique model
Maker
Profit
abcd1234
-
56
zgh675
Company Y
40
abcd1234
Company X
3
zgh675
-
10
abcd1234
Company X
1
Which query can I use to automatically reach the following (the list of Makers is dynamic but every model can only go to one of them):
Unique model
Maker
Profit
abcd1234
Company X
60
zgh675
Company Y
50
?
You may aggregate by unique model and then take the MAX value of the maker, along with the sum of the profit:
SELECT model, MAX(maker) AS maker, SUM(profit) AS profit
FROM yourTable
GROUP BY model;
This approach should work assuming that each model only has one unique non NULL value.
I am creating a spare part management database in Microsoft Access. I have two table which are ItemTable and EntryTable. ItemTable holds information about each item with unique ItemID and EntryTable holds information of each items usage. I need to calculate the total stock left for each items based on the usage.
So as you can see, for the ItemID with 2, i need to calculate the total stock left based on the usage of In or Out of Status field.
If status is In then plus elseif status is Out then minus. Then total the stock of ItemID 2. Thus the total stock for ItemID 2 will be 3. I have figured out by total and group by for the ItemID but i cannot figure out the way to subtotal based on condition from other column. Thank you.
You can do it with conditional aggregation:
select itemid,
sum(iif(status = 'In', 1, -1) * quantity) as total
from entrytable
group by itemid
I need to fill bank deposit slip, deposit slip in the format of 3 columns for Amount
I want to fill the amount column by column in an orderly manner
But in the table field is the only Amount
You can specify the row and column that each amount should be in using RowNumber functions inside a matrix.
Insert a matrix into the report. Set the columns to be grouped by:
=(RowNumber(Nothing) +1) Mod 3
Set the rows to be grouped by:
=Ceiling(RowNumber(Nothing) / 3)
Here's an example of how the results would look:
I have the following crystal report, I want to calculate the sum of each row of specific columns:
Opening Quantity
Purchase Quantity
Issue Quantity
if sum of the above 3 columns is equal to 0.00, then do not print that record.
Please look out at the screenshot of generated report:
I am to guess here that the fields are placed in the DETAIL section , if then you can use the suppress formula(Section Expert-->Detail Section-->Suppress formula)
and try something like this
{Opening Quantity field} + {Purchase Quantity field} + {Issue Quantity field} = 0
I think this can give some idea to you
1) you have to create a formula to sum up the opening quantity, purchase quantity and Issue quantity by using Running Total Field.
Let say your field name for opening quantity inside the TableA is 'opening quantity'.
Thus, choose Table A, inside the Running Total Field and find the 'opening quantity'.
Then, choose 'SUM' as Type of Summary.
Do the same for another two fields.
At last, you will have 3 different running total field formula.
2) combine together these 3 formula inside one new formula.
Your final formula should look like this.
Let say you name it as Formula 4
if {#Formula1}+{#Formula2}+{#Formula3}<>0 then {#formula1}+{#formula2}+{#formula3}
then you drag this formula to any space in the report that you want the total to appear.
3) After drag it, right click on the formula and press 'Format Object'
Check the suppress box and write this inside the blue cross tab beside the suppress checkbox
{#Formula4}=0
How can I do a SELECT with an ORDER BY item.price ASC condition on a multiple currency database table?
I'm not sure if it is possible.
Item table has price, currency properties with a lot of currencies of all types.
One way would be to have another table with a conversion rate which would allow you to express each price converted to a common currency. Your ORDER BY would then be done based on the common currency.
For example:
SELECT item, price as local_price, price * common_conversion_rate as comparison_price
FROM item_table
left join conversion_rates ON item_table.currency = conversion_rates.currency
ORDER BY common_conversion_rate * price
The conversion_rates table then contains columns:
currency common_conversion_rate
USD 1.0
GBP 1.4
ZAR 0.1
...
This assumes that you can just pull the currency from your item table and multiply it by a factor from the conversion_rates table.