Hello,
I have a question about the event to which I attach my macro.
I have a sales form and a macro for add a field called total to a
table field called saldo_cliente from a cliente table.
If I assign the macro to the event button mouse released Calculate
Total button will increase the balance each time
the user makes a click on the button and that is not exactly the idea.
The idea is that only increase the saldo_actual once, to save the record.
On the other hand, should only be added the total to the saldo_actual
field in the table cliente if it is a new record,
but if it is a modification, it should analyze the situation and as
the case add or subtract the saldo_actual.
While if it is a deletion, should subtract the total saldo_actual field.
So I understand that I have to do actually 3 macros, right? One for
new records, one for
modifications and one for deletions.
What is not clear for me is that events should put macros for this scheme work.
I just do not want that any time the macro is triggered, for example
at the press of a key. I wanted to shoot only once,
such as the data stored. Spend that otherwise will be adding double,
triple, etc.. the total amount ...
The issue is that in my database are on the one hand Sales and on the
other hand Payments Sales, in two different forms,
whose tables are not related to each other because there is in fact a
relationship between them.
In terms of sales, what I want to do is take the field from the
Customer table saldo_actual current balance of the
customer is always consistent, as recorded total sales in the form of
sales for a given customer. That is, as I
understand it, if you add a new record, for example, (in the form of
sales) should add value to the field saldo_actual.
If you change the record, the question is whether to subtract or add
the field. And if you delete a record (in the form
of sales) should be subtracted saldo_actual field value in order to
always keep consistent with the actual values. This
field is an internal field saldo_actual only I use to work with the
database. It is not loaded by the user at any time.
Then there is the form of payments of sales, which is independent of
sales, which also works with saldo_actual field.
I'm also doing the macro to this form and I have just a mistake. In this
form of Payments Sales, the idea is that when you select a customer in
a combo box display the current balance thereof
(as indicated at the time in the field saldo_actual), and by the
amount written in the form of payments Sales, have a
button to calculate the new balance and modify the registry
saldo_actual customer table, (I'm also doing the macro to
this button but still not working - I understand this macro also
probably have to have the same schema of the first,
as to have 3 macros that trigger to insert, modify and delete. This is
in order to always keep consistent the saldo_actual
field with the actual values. ).
This is because I need to know on the one hand, the overall balance of
the customer and also the history of the
different balances that was having this (this is for a later
generation of reports).
I would appreciate very much a help with this please.