Hi, I have an issue with the following code working some of the time. I have a continuous bound form to the table tblTempIncoming, but the last entry on the form does not count toward the RecordCount of tblTempIncoming even though the last entry has been correctly stored to the table. This is the case when you don't click on the line following the last entry, but if you do click on the line following the last entry, the RecordCount of the table is correct. It is odd to me that the data can be stored correctly then "read" incorrectly at the same time. Any advice towards improvement on this functionality and/or solution to my problem will be appreciated.
Code:
Set db = CurrentDb
Set rsRec = db.OpenRecordset("tblTempIncoming") 'the bound table
Set rsInvUniq = db.OpenRecordset("tblUniqueFinishedInventory")
For i = 1 To rsRec.RecordCount
Debug.Print "this recordset has reached record number ", i
PartID = rsRec.Fields("TempPartID")
Received = rsRec.Fields("TempQuantity")
rsInvUniq.MoveFirst
For j = 1 To rsInvUniq.RecordCount
If PartID = rsInvUniq.Fields("PartID") Then
rsInvUniq.Edit
rsInvUniq.Fields("CurrentInventory") = rsInvUniq.Fields("CurrentInventory") + Received
rsInvUniq.Update
End If
rsInvUniq.MoveNext
Next j
rsRec.MoveNext
Next i