I have been working with my Access database during some days, I started saving my work, and the app was instantly closed. When I opened it again, all my new data for a day was lost. Is there a variant to get my data back? I am using MS Access 2013 on Windows 8.1 x64.
any record in edit mode is automatically saved.
but I cannot think of any reason for all records to be lost.
did you open the correct db?
did you open it via access, file, recent files? This could open the wrong file.
are the tables split? linked to the correct BE files?
In wrote code for a backup of the tables. clicking a button makes a copy of the backend, to a remote spot with a datestamp.....mytables_180306.accdb
Mechanically, Access won't close until it goes through what is called "process rundown" - which involves writing back all committed updates and any "dirty" disk buffers. (Not necessarily referring to "dirty" records!)
This occurs because Windows and Access perform something called a "disk write-behind" operation for output buffers. Access updates the disk buffer in memory and then moves on, leaving the asynchronous disk driver to play catch-up because it might be busy writing back other information at the moment. And don't forget that the disk driver is shared by the page manager, swap manager, and all Windows functions that can contribute to any of the system log files. So the disk driver works it little head off to play catch up - and anything needing to write has to sometimes wait, which is WHY the write-behind system was set up in the first place. Keeps the disk from being a total bottleneck on a busy system.
When you close the app, you force Access to freeze until the disk driver signals that it has no more pending write-backs for the MSACCESS.EXE host process. This is a case where execution is blocked totally. In essence, Access CANNOT exit until that write-back occurs because it is in an I/O wait state of an involuntary nature. During that rundown time, ALL PENDING UPDATES get written back. ALL of them.
Therefore, if you are losing data, there must be something about the way you are trying to save it that causes it to be discarded. Not accusing you of ANYTHING bad here, but what I am saying is that somehow you are not saving the data correctly.
For instance, if you performed a bulk update with a "Begin Transaction" operation but then failed to issue the matching "Commit" operation, the database would HAVE to roll back the changes when you tried to exit without commitment. (I had a girlfriend like that once... but I digress.)
Another possibility is to use a construct involving an SQL statement for a DAO database, something similar to
Code:
CurrentDB.Execute SQLString
where the SQLString is an SQL "Insert Into" query. This normally works, but if you have errors in the SQL execution and don't have error notification set up, this SILENTLY rolls back on that error.
That's just two ways it could happen that you would lose data. I'm sure there are more ways, but these two are common enough.
charlarmstr, Dext brings up a valid point. Can you do/have you done a Compact & Repair on your DB? And I repeat my point about whether notifications have been disabled? That might block error messages that you would need to know about for a miscreant DB file.