Creating a calculating control on an Access form

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

Guest

I would like to input a dollar amount into a form field called "InvoiceAmt".
This amount would then be automatically totaled in a separate form field
called "Total Invoiced". Each time a new dollar amount is entered into this
same "InvoiceAmt" field, it would be automatically added to the existing
value in the "Total Invoiced" field. The "Total Invoiced" field must be some
type of cumulative total control and I'm unable to create the expression to
make this work. Thanks so much.
 
If InvoiceAmt is part of a cumulative form and a new record is created for
each dollar amount, you can set the Control Source of TotalInvoiced to =Sum(
[InvoiceAmt])

If you are clearing InvoiceAmt everytime there is a new entry, you can set
TotalInvoiced through code:
Total nvoiced = TotalInvoiced + InvoiceAmt

Gina
 
I meant continuous form not cumulative -- its Friday!
If InvoiceAmt is part of a cumulative form and a new record is created for
each dollar amount, you can set the Control Source of TotalInvoiced to =Sum(
[InvoiceAmt])

If you are clearing InvoiceAmt everytime there is a new entry, you can set
TotalInvoiced through code:
Total nvoiced = TotalInvoiced + InvoiceAmt

Gina
I would like to input a dollar amount into a form field called "InvoiceAmt".
This amount would then be automatically totaled in a separate form field
[quoted text clipped - 3 lines]
type of cumulative total control and I'm unable to create the expression to
make this work. Thanks so much.
 
Gina,

I did try to put the following expression "TotalInvoiced = TotalInvoiced +
InvoiceAmt" in the source property for the "TotalInvoiced" control but
received a #ERR message. Am I writing the expression in the wrong property?
The InvoiceAmt field is for an individual record (does not total across
records). When a dollar amount is typed in the "InvoiceAmt" field, it should
update (add to) the "TotalInvoiced" field. The "InvoiceAmt" is cleared of the
previous value each time a new amount is entered. I know I could have several
Invoice fields and sum them, but there would be too many fields, then.

Thanks so much.

Marilyn
Gina via AccessMonster.com said:
If InvoiceAmt is part of a cumulative form and a new record is created for
each dollar amount, you can set the Control Source of TotalInvoiced to =Sum(
[InvoiceAmt])

If you are clearing InvoiceAmt everytime there is a new entry, you can set
TotalInvoiced through code:
Total nvoiced = TotalInvoiced + InvoiceAmt

Gina

I would like to input a dollar amount into a form field called "InvoiceAmt".
This amount would then be automatically totaled in a separate form field
called "Total Invoiced". Each time a new dollar amount is entered into this
same "InvoiceAmt" field, it would be automatically added to the existing
value in the "Total Invoiced" field. The "Total Invoiced" field must be some
type of cumulative total control and I'm unable to create the expression to
make this work. Thanks so much.
 
You should be putting it in the AfterUpdate event for InvoiceAmt

Private Sub InvoiceAmt_AfterUpdate()
If Me.InvoiceAmt > 0 Then
TotalInvoiced = Nz(TotalInvoiced, 0) + InvoiceAmt
End If
End Sub

I didn't put any error checking in, but that should keep a running sum of the
numbers.
Gina,

I did try to put the following expression "TotalInvoiced = TotalInvoiced +
InvoiceAmt" in the source property for the "TotalInvoiced" control but
received a #ERR message. Am I writing the expression in the wrong property?
The InvoiceAmt field is for an individual record (does not total across
records). When a dollar amount is typed in the "InvoiceAmt" field, it should
update (add to) the "TotalInvoiced" field. The "InvoiceAmt" is cleared of the
previous value each time a new amount is entered. I know I could have several
Invoice fields and sum them, but there would be too many fields, then.

Thanks so much.

Marilyn
If InvoiceAmt is part of a cumulative form and a new record is created for
each dollar amount, you can set the Control Source of TotalInvoiced to =Sum(
[quoted text clipped - 13 lines]
 
Back
Top