Ok, I have 2 fields for the combined total.
No. You don't.
You have two FORM CONTROLS for the combined total. Fields exist in
tables; Controls exist on forms. It's easy to confuse them - but
don't!
1 is [Total] which has the
equation in it, the other is [calc] which is the one (I believe) that will be
used to put the Total in the table. I tried what you said, and the error
that came up unable to find field [calc].
My *intention* - perhaps not clearly expressed - was to have two
Textbox controls; the one I called txtCalcControl1 was the unbound
control name, with an expression as its Control Source. The textbox
named txtBoundControl1 was to be bound to some field in the Table, and
that field must be part of the form's recordsource. You've chosen to
assign your own names to these controls, which was my intent... but
that's what *I* posted. I did not post anything suggesting that you
have controls named Total or calc - those are *your* idea.
I have as the control source on field [Total] the equation, the control
source on field [calc] is set to field [Total]. The VBA code is:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Me![calc] = Me![Total]
End Sub
Is there a Textbox on the form with a Name property of
calc
If there is what is its Control Source?
What is the name of the table field into which you wish to store the
value calculated in the Total textbox?
What you need is:
- A Field (currency datatype I'd guess) in your Table into which you
wish to store the total value
- That Field must be included in the Form's Recordsource query
- You need a Textbox (named calc, or MyCalculatedFieldRelay, or
whatever name you like) with this field as its Control Source property
- The code should set that textbox to Me!Total
John W. Vinson[MVP]