Hi,
I am having issue with the below code editing the record, updating then moving to the next record. It only updates the first record in the Recordset. Is there anything in the syntax I missed?
Code:
Private Sub btnSave_Click()
Dim r As DAO.Recordset
Set r = CurrentDb.OpenRecordset("SELECT * FROM FilterCancellationReview")
'Check to see if the recordset actually contains rows
If Not r.BOF Then
r.MoveFirst
Do Until r.EOF = True
'Perform an edit
r.Edit
If Me.HMDADisposition = "Approved" Then
If Me.HMDAApprovedStatus = "HANA" Or Me.HMDAApprovedStatus = "HANT" Or Me.HMDAApprovedStatus = "HCAN" Or Me.HMDAApprovedStatus = "HCLO" Or Me.HMDAApprovedStatus = "HREN" Or Me.HMDAApprovedStatus = "HUWD" Then
Me.CurrentWF = APPR()
Me.DateComplianceReviewed = Now
Me.ComplianceReviewed = True
End If
End If
If Me.HMDADisposition = "Declined" Then
If Len(Me.RequestorNotes) > 5 Then
Me.CurrentWF = DECL()
Me.DateComplianceReviewed = Now
Me.ComplianceReviewed = True
End If
End If
If Me.HMDADisposition = "Duplicate" Then
Me.CurrentWF = NOTF()
Me.DateComplianceReviewed = Now
Me.ComplianceReviewed = True
End If
If Me.HMDADisposition = "No Change" Then
Me.CurrentWF = NOTF()
Me.DateComplianceReviewed = Now
Me.ComplianceReviewed = True
End If
r.Update
'Move to the next record. Don't ever forget to do this.
r.MoveNext
Loop
End If
MsgBox "Changed have been saved."
r.Close
Set r = Nothing
'DoCmd.Requery
End Sub