Question : Update multiple records at one time

I have a form that has multiple records in the detail section.
I take information from these records and update two fields [DedRemCaptured] and [CaptureDate] on a different table [tblInvoiceDetail] using the following code:

CurrentDb.Execute "update tblInvoiceDetail set DedRemCaptured=" & Me.CurrentDedRemain & ",CaptureDate=Now() where [SystemID]='" & Me.[SystemID] & "';"

The problem is that only the first record is updating. Each record has a unique [SystemID]. I would like all records to update.

Answer : Update multiple records at one time

in the click of a button
private sub Btn_click()
with me.recordset
     .movefirst
     do until .eof

       
CurrentDb.Execute "update tblInvoiceDetail set DedRemCaptured=" & Me.CurrentDedRemain & ",CaptureDate=Now() where [SystemID]='" & Me.[SystemID] & "' and DedRemCaptured Is Null"

     .movenext
     loop
end with
end sub
Random Solutions  
 
programming4us programming4us