Hi all,
I have a continuous form that is bound to a query. It pulls the data from a table if certain fields are empty. If I update the fields that are empty a function is run to check if the data is valid and then moves to the next record.
This all works fine if I am working on the first record but if I select any other record and fill in the empty fields then it updates the first record.
The following code is what runs on the afterupdate event of the field that has been updated:
I have added a message box to test what the current record is and this displays the correct record number but the field for this record is not the one that is updated.
Any help would be much appreciated
Gareth
I have a continuous form that is bound to a query. It pulls the data from a table if certain fields are empty. If I update the fields that are empty a function is run to check if the data is valid and then moves to the next record.
This all works fine if I am working on the first record but if I select any other record and fill in the empty fields then it updates the first record.
The following code is what runs on the afterupdate event of the field that has been updated:
Code:
Dim Answer As String
Dim db As DAO.Database
Dim Rslt As DAO.Recordset
Dim RecNum as integer
Set db = CurrentDb()
Set Rslt = db.OpenRecordset("QryOutstanding")
Answer = CheckInvoiceExists(InvoiceNo)
RecNum = Me.CurrentRecord
MsgBox RecNum
Rslt.Edit
Rslt.Fields(9) = Answer
Rslt.Update
Rslt.Close
DoCmd.RunCommand acCmdSave
Me.Requery
I have added a message box to test what the current record is and this displays the correct record number but the field for this record is not the one that is updated.
Any help would be much appreciated
Gareth