I am having trouble trying to figure out what is happening to the data on a table. The table I have is a product table that stores the quantity on hand. I have code that runs on a form to either add inventory when made or subtract it when used.
I have been tracking the data in a spread sheet to make sure it matches the table. The column labeled DB Balance is the adjusted amount in the database. The other columns are what I use in the spread sheet. Three times so far an entry on the table has been incorrect; none of them are the same entry either. Twice it did not add in the inventory and once it did not remove it from the table.
The part I cannot figure out is how the quantity adjusted can be correct on two entries and wrong on the third one when all three of them are adjusted together.
Example: (one that did not get subtracted)
Part | Start Inv | Made | Used | Balance | DB Balance | Where Used | Match |
AX03A-AK | 301 | 100 | 168 | 233 | 233 | AG00A | TRUE |
XA02A-AK | 413 | 0 | 168 | 245 | 245 | AG00A | TRUE |
XA00A-AK | 206 | 220 | 168 | 258 | 426 | AG00A | FALSE |
All entries were to remove 168 parts from each record on the table, the first two are correct and the last one is wrong. The 168 parts did not get removed.
I cleared out the table and re-entered all the information that the administrators key in the database. I ran the code step by step for all entries. The second time around it balanced out correctly and did not duplicate the error.
I am not sure what is causing this. Can the personnel get to the next record faster than it takes for the code to finish looping? Can there be some lag in the network? Is it some bug with-in Access? Or, is there something I could have done different either in my code or the approach I used.
I just find it strange that on the first two days it all balanced out, then the next few days it did not balance.
I have attached the code that I use in the form.