This month, our database isn't running a process the same as it has in the past. Specifically when it gets to rsV.NoMatch, in a past model the code has continued through the rsV.AddNew procedure, but this month, it will always skip this section and go to the Else statement after.
When I look at the data in qryAppendForecasts, the data looks the same in both months. tblVolumes starts out blank in both cases. Any ideas?
When I look at the data in qryAppendForecasts, the data looks the same in both months. tblVolumes starts out blank in both cases. Any ideas?
Code:
Set rsV = db.OpenRecordset("tblVolumes")
rsV.Index = "ImportIndex"
Set rs = db.OpenRecordset("qryAppendForecasts")
If Not rs.EOF Then
rs.MoveFirst
Do
rsV.MoveFirst
rsV.Seek "=", rs!COC, rs!Plant, rs!mf5an8
If rsV.NoMatch Then
rsV.AddNew
rsV!PlantNum = rs!Plant
rsV!ShipTo = rs!mf5an8
rsV!COC = rs!COC
fld = Format(rs!drq, "mmm") & "Est"
rsV.Fields(fld) = rs!Vol
rsV!SalesRep = rs!mf5Oss
rsV!CMI = rs!CMI
rsV.Update
Else
rsV.Edit
fld = Format(rs!drq, "mmm") & "Est"
rsV.Fields(fld) = rs!Vol
rsV.Update
End If
rs.MoveNext
Loop While Not rs.EOF
End If
rs.Close
rsV.Close
Set rs = Nothing
Set rsV = Nothing