User-72198832 posted
I have three Numeric columns: LastMeter, NewInput, UsageInput on a bound datagrid
When editing NewInput I would like to display value of NewInput - LastMeter
in UsageInput Column
Example: LastMeter=1000, MeterInput=1200, UsageInput is calculated value of 200
Once I trap the AccessDataSource Update event, how do I access these fields and put the calculated result in the Update Event SQL?
Unmodified Update SQL is as follows:
UPDATE [EquipmentUsage] SET [EquipName] = ?, [EquipGroup] = ?, [UsageYTD] = ?, [LastMeter] = ?, [MeterInput] = ?, [UsageInput] = ? WHERE [EquipID] = ?
Need something like:
Private Sub AccessDataSource1_Updating(.....) 'Trapped Update Event
IF MeterInput > LastMeter Then 'how do I access these values
UsageInput = MeterInput - LastMeter 'and how to replace calculated value
AccessDataSource1.UpdateCommand= ????? 'do I need to change the Update command?
End If
End Sub
End If
Again, All help is appreciated.
Regards,
Lee