Addition of currency to a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created a table called Accounts which contains:
AccountID
Account Type
Account Balance

I would like to create a form that add's amounts to the Account Balance
field in the table. Every time the account receives more money I would like
a way to add that amount to the field. I tried creating a form but it seems
to just override the inital amount.

Would anyone know a way of doing this?
 
Franca,

I take it the Account Balance control on your form is bound to the table
field, right? Well, you need to add one more text box on the form to
enter the new transaction amount (call it, say, Received), and then make
the button run a macro with a SetValue action, arguments:
Item: [Account Balance]
Expression: [Account Balance]+[Received]

If you want, you can add a second button with another macro to do the
same with [Account Balance]-[Received] for deduction from the account
balance (payments), or use a credit/debit option group and do it with
one button and one macro with conditions.

HTH,
Nikos
 
Hi, Thanks for the reply.

the account balance control is on the form and is bound to the table field.
I added another text box and gave it the name received. Now how do I add
the macro to the text box? Would it be Before Update. I tried adding it
there but I get an error saying it can't find the name account balance. I
ensured that the spelling was correct and that was the name of that field.
You say something about a button, did you want me to add a button instead of
a text box?

Nikos Yannacopoulos said:
Franca,

I take it the Account Balance control on your form is bound to the table
field, right? Well, you need to add one more text box on the form to
enter the new transaction amount (call it, say, Received), and then make
the button run a macro with a SetValue action, arguments:
Item: [Account Balance]
Expression: [Account Balance]+[Received]

If you want, you can add a second button with another macro to do the
same with [Account Balance]-[Received] for deduction from the account
balance (payments), or use a credit/debit option group and do it with
one button and one macro with conditions.

HTH,
Nikos
I have created a table called Accounts which contains:
AccountID
Account Type
Account Balance

I would like to create a form that add's amounts to the Account Balance
field in the table. Every time the account receives more money I would like
a way to add that amount to the field. I tried creating a form but it seems
to just override the inital amount.

Would anyone know a way of doing this?
 
Franca,

I proposed a button instead of an event of the control itself, so you
have control of when to add the amount received to the balance. If you
use a control event such as Before Update, then it will be added
everytime you enter a new amount, even if you type in the wrong amount,
before you have the time to correct it!
Come to think of it, I would add a second SetValue action to the macro
to reset Received to Null once the balance has been updated, so you
can't add an amount twice by accidentally clicking on the button twice.

Now, to the error message you get: I assumed the control bound to field
Account Balance is also called Account Balance; apparently it is not.
Open the form in design view, select the control, display its properties
and check its actual name in the Name property on tab Other; change
Account Balance to the actual control name in both Item and Expresson
arguments of the SetValue property.

By the way, I assumed that both the Received and the Account Balance
(whatever it's called) controls are in the same section of the form,
i.e. both in the main form detail, or in the same subform. Any chance
they are not?

Nikos
Hi, Thanks for the reply.

the account balance control is on the form and is bound to the table field.
I added another text box and gave it the name received. Now how do I add
the macro to the text box? Would it be Before Update. I tried adding it
there but I get an error saying it can't find the name account balance. I
ensured that the spelling was correct and that was the name of that field.
You say something about a button, did you want me to add a button instead of
a text box?

:

Franca,

I take it the Account Balance control on your form is bound to the table
field, right? Well, you need to add one more text box on the form to
enter the new transaction amount (call it, say, Received), and then make
the button run a macro with a SetValue action, arguments:
Item: [Account Balance]
Expression: [Account Balance]+[Received]

If you want, you can add a second button with another macro to do the
same with [Account Balance]-[Received] for deduction from the account
balance (payments), or use a credit/debit option group and do it with
one button and one macro with conditions.

HTH,
Nikos
I have created a table called Accounts which contains:
AccountID
Account Type
Account Balance

I would like to create a form that add's amounts to the Account Balance
field in the table. Every time the account receives more money I would like
a way to add that amount to the field. I tried creating a form but it seems
to just override the inital amount.

Would anyone know a way of doing this?
 
Back
Top