Save rst changes and display on form

vmon

Registered User.
Local time
Today, 16:00
Joined
Jan 21, 2003
Messages
49
I have a form that calls a public sub to calculate a column for each record in a subform. The code is working but the changes are not committed. If I make a change to a record after the sub runs it asks me to Save, Copy to Clipboard, or Drop changes. Also the edits to each record are not displayed on the form after the sub runs. I am missing somthing below that saves the changes and updates the form.

Any ideas?
vmon

Public Sub ' Called from after update on subform field
'load recordset.....

rst.Edit
rst.Fields("MeterFootage") = 0
rst.Update


End Sub ' return to subform
 
You need to requery the subform control or subform depending where the focus lies if the records in the subform are changed and you need to reflect the changes.

If the column is a function of other columns in your db there is no advantage to storing calculated values. Use the same calculation or function call to return the resulting value to an unbound text box. You could set the function call as the default value the textbox and lock it down and disable it if you wished.
 
There is something wrong with your design. Changes to one table should not force changes to another and changes to one row should not affect any other rows. Properly structured tables would be isolated from this type of processing. Probably you have data stored at too low a level.
 
I figured out a way through it. I added a save record.

If you don't mind offering advice. I have a header and detail. The header has a MeterBegin and MeterEnd number. Each detail record has a MeterStop number which must be between the MeterBegin and MeterEnd. Also on the detail I calculate and at this point store the difference between MeterStop and MeterBegin. The problem comes with multiple detail records where the second and subsequent records use the StopMeter of the previos record as their MeterBegin to calcuate difference between it and StopMeter.

I know I shoulda/coulda NOT stored the calculated value but the difference (actual meter count for each detail) is used but lots of forms and reports.

thanks for the advice,
vmon
 
Since you know you shouldn't store te calculated value but have chosen to anyway, you are obviously prepared to deal with the potential data anomolies.
 

Users who are viewing this thread

Back
Top Bottom