L
lad5ko via AccessMonster.com
Hi,
I need multiply fields [Price] and [Amount] and result write into field
[Result1] into current Record (opened in form). My code multiplies always
[Price] and [Amount] from first record of Tab1 and writes result also into
first record of Tab1, not into current record that I can see in my form.
Any help will be appreciated.
Thanks in advance.
L.P.
Private Sub Button1_Click()
Dim MyDb As DAO.Database, MyTable As DAO.Recordset
Dim Result1 As Double
Set MyDb = CurrentDb()
Set MyTable = MyDb.OpenRecordset("Tab1", dbOpenDynaset)
Result1 = MyTable![Price] * MyTable![Amount]
MyTable.Edit
MyTable![FieldA] = Result1
MyTable.Update
MyTable.Close
MyDb.Close
End Sub
I need multiply fields [Price] and [Amount] and result write into field
[Result1] into current Record (opened in form). My code multiplies always
[Price] and [Amount] from first record of Tab1 and writes result also into
first record of Tab1, not into current record that I can see in my form.
Any help will be appreciated.
Thanks in advance.
L.P.
Private Sub Button1_Click()
Dim MyDb As DAO.Database, MyTable As DAO.Recordset
Dim Result1 As Double
Set MyDb = CurrentDb()
Set MyTable = MyDb.OpenRecordset("Tab1", dbOpenDynaset)
Result1 = MyTable![Price] * MyTable![Amount]
MyTable.Edit
MyTable![FieldA] = Result1
MyTable.Update
MyTable.Close
MyDb.Close
End Sub