D
DS
How do you have a calculated field update automatically without having
to go to the next record?
Thanks
DS
to go to the next record?
Thanks
DS
Great thank you, that beats the macro I set-up to go to next record,Wayne said:Depending on the calculation, it will automatically. If the calculation is
coming from another source, such as a subform or parent form of the form the
control is on, you sometimes have to tell it to recalculate. Depending on
the calculation, one thing to remember is that if the data comes directly
from the table, such as in a DLookup function, that the value won't be
available until the record is saved.
To recalculate try
Me.Recalc (this will get all calculated controls on the form)
or
Me.txtMyTextbox.Requery (this will get just the one control)
If you need to force a save of the record,
If Me.Dirty Then Me.Dirty = False
Which event you place any of this code in will depend on what you're doing
at the time you need this done. For the first two, the AfterUpdate event of
the control you changed to make the recalculation necessary may be a good
choice. For the last one, the Click event of a button on the form would
work.