An expression in access to substract numbers - ms-access

I have a table named DispatchTracker and in the table I have Receipt, Payment and Balance columns. Now the Balance column is a calculated field, I want a formula in the balance column that will add when cash is received and substract when payment is made.

A calculated field operates on the current record only.
Remove the Balance column and use a query to calculate the current balance.

Related

How to calculate a sum of entries (balance) efficiently in SQL?

We have a table "bookings":
id int
amount float
user_id
A users "balance" is the sum of all bookings. After years and some users with 100k+ entries that calculation is getting slow.
I have 2 solutions in mind:
Create a "balance" column in "users" table and add or substruct amounts each time a booking is added
Create a "last_balance" column in "users" table that is updated once a year with the users balance on the 01.01. 00:00:00, then balance is "last_balance" + sum(all-bookings-since-01.01.)
The issue with 1) is that any bug or delay in the db might result in a wrong balance. Therefore I think the balance should rather be the sum of bookings than an individual number.
Is there a "right" way to calculate a users balance in any system where users hold money?

How to update another column if one column is changed?

Here, I have table named customer_ac with fields ac_no, amount, due_date, interest, total.
If the amount goes above Rs. 30. Then due_date is created 7 days from today,
If the due_date is passed then total should be updated automatically.
How can I do this?

Date is automatically resetting to beginning once it reaches the month end in SSRS

I have a matrix table which contains a day(currentdate value) as row group and month as a column group. The column group has two child columns one contains the data represents a value which falls on that particular day of that month and another is a running value. like wise the column values represents for current and previous month. Now the problem is for the month which doesn't have the date 31 contains the data which actually belongs to the particular months start date data. to understand how the data is populating for that particular row I added a column of date field. it shows the start date of the month.
I would like to know how to avoid this automatic data resetting.
Sample image of the issue

Sum a Subtotal in MS Access by Date

I'm using MS Access 2010
My query has the fields, Date, Market Price, Actual Price
I need to separate out within the query by date Actual Price/Market Price in order to achieve a percentage which I can then average (for that day only, one day at a time)
Each day will have anywhere from 10-50 items.
You'll want to use a standard query, but a totals to the query. On the Home tab, in the Records group, click Totals.
Once you have that field displayed you can put a Sum (in the Totals field) for Market Price and Actual Price; and then make sure the Date field is set to GroupBy.
Then you should be getting totals for the Price fields grouped by Date.
btw., I'd label that date field something else other than just Date (e.g., DateSold, PurchaseDate, etc.) just to avoid confusion and possible conflicts with the Date type.

Access: Auto-Fill in values in a table based on certain criteria. (Payment schedule)

I basically want to create a payment schedule in a separate table based on 4 values that a user would select. The payment schedule is very basic and the table only needs 2 columns, 1) Date of payment, 2) payment amount.
The 4 criteria values that are used to fill out this simple table would be: 1) the total amount of money, 2) number of payments, 3) the frequency of the payments (monthly, quarterly, semi-annually, annually), 4) the date of the first payment.
The way that I envision this is having a Form where these 4 values will be selected. On that form there can be a button to execute the command to fill in a datasheet with the appropriate values.
The first entry would obviously be on the date of the first payment, and the amount for that entry would be the total amount divided by the number of payments. For the second record dollar amount would be the same and the date would be the first payment date + the frequency. So if the first payment date is 1/1/2000 and the frequency annually, then the second entry date would be 1/1/2001. Etc.. until the last payment is made.
While it is a pretty simple payment schedule, I'm not sure how to best approach this in Access and if it's even possible. Would appreciate some input and direction. Thank you!
You will need
-- A numbers table with integers from 0 to the highest number of payments possible, indexed on the number.
-- A combobox called Frequency on forms payments with the following properties:
Row source: q;quarter;m;month;ww;week
Row source type : value list
Bound column : 1
Column count : 2
Column widths : 0, 1
-- A query
INSERT INTO Payments ( UserID, PaymentDate, Payment )
SELECT [Forms]![Payments]![UserID],
DateAdd([Forms]![Payments]![Frequency],
[Number],
[Forms]![Payments]![Startdate]) AS Expr2,
[Forms]![Payments]![LoanAmount]/
[Forms]![Payments]![NumberOfPayments] AS Expr3
FROM Numbers
WHERE (((Numbers.Number)<[Forms]![Payments]![NumberOfPayments]));
-- A button to run the query.