After database corruption, errors are being produced - vba

I had a split database working fine on a clients machine for over 2 years. Due to unknown circumstances the database became corrupted. And was fixed by the removal of a couple of corrupted records.
The front end has now began to produce the following errors:
2147352567
2448
These errors will be thrown individually when a user performs a certain action.
How can it be that these errors have suddenly started to show themselves up when before everything was working fine?
Without wanting to bog down this question with code, the premise of the forms when the error occurs are that:
A form is open and an excel spreadsheet may also be open that relates
to that record.
On save/close of the excel spreadsheet a corresponding field in the database record is updated.
The user decides to 'Update Excel Spreadsheet' or 'Save and Close'
The errors occur on Before_Update events on the access form
Is there any reason that these errors might have started occurring in what appeared to be a perfectly working system?
Thanks in advance for any assistance.

I have resolved the issue by including in the code an appropriate update record:
If Me.Dirty = True then
Me.Dirty = False
End if
Still don't understand how the errors began to arise though after the DB became corrupted? The forms/buttons/actions would have been used daily by the users during their working week for over 2 years.

Related

Run-Time error '3048' happening even though I close connections

I've been getting an error that I've never seen before. I keep seeing this:
Run-time error '3048':
Cannot open any more databases.
Having Googled it, it seems this happens when there are very complicated forms that have lots of lists or combo boxes that have their sources as a table/query. However, I've not changed these forms for a while now and I'm all of a sudden seeing this. Plus, my forms really aren't that complicated, usually just a single list and maybe 1 or 2 combo boxes. I just started seeing this error yesterday (2/2/22)
Almost in all cases I'm accessing the tables by using this code:
Dim rst As Recordset: Set rst = CurrentDb.OpenRecordset("table name or SQL statement")
Then I'll access data using something like, whether it be AddNew, Edit, or just looping through a recordset.
With rst
.AddNew
.Fields("name") = "Value"
End With
OR
Do Until rst.EOF
'Do something
.MoveNext
Loop
And I've already double checked that every time I open a recordset I close it
rst.Close
Set rst = Nothing
However, I keep seeing that error now. Is there some other way that I'm supposed to close these recordsets that properly closes the connection? I'm guessing opening these is causing something to linger that I'm not aware of.
the only solution I have right now is to completely restart my PC and then I can use it for a bit before I see the error again.
Thanks for your help!
EDIT: When I get that error, I can't even close everything in Access and manually open a table to look at it. I get this error message
Reserved error (-1104); there is no message for this error.
This is, sadly, a known current bug:
Access doesn't close properly. A remaining background process can only be terminated in task manager
There is no official info or remedy yet.
I also got these problems after updating Office 365 tot the latest version (221, build 14827.20158). When I close the Access application and reopen it, I immediately get the error. Then I first have to resatart my computer in order to have the application working until it reaches the max amount of conections.
When opening a database of an earlier version (.mdb format) in Microsoft Access version 2013 or later, you may encounter an error ‘Cannot open a database created with a previous version of your application.’
You can fix the error by converting the old database file format (.mdb) to the .accdb file format.
To work around this, Microsoft recommends opening the Access database (MDB) in Access 2007 or later versions, and then saving it in the file format you can open in Access version 2013 or higher.
Follow the below link to perform the steps to convert the .mdb file to .accdb file format:
https://support.microsoft.com/en-us/office/convert-a-database-to-the-accdb-file-format-098ddd31-5f84-4e89-8f44-db0cf7c11acd#
Best Regards,
Alice

MS Access Backend data corruption

I have an Access database that was designed and developed back in 1997 - 99. all user interaction is through forms and reports, there is no end user access to the backend tables. It has worked flawlessly for the last 19 plus years. Both front and back end are still in .mdb format, but the front ends which are local to the workstation and are replaced with a clean copy upon every login are running on Access 2016. There are at a maximum, 6 users in the database at one time, usually there are only 4.
Starting about 90 days ago the back end would randomly corrupt when a request to write a record was made. The error message is “Database is in an unrecognized format”. We have replaced old workstations and the Server that host the back end, in addition we replaced the switch that all computers connect to. On the workstations that were not replaced Office has been re-installed and all updates applied to it. The corruptions cannot be reproduced consistently, it happens in different forms and from different workstations randomly. After the corruption, we have to delete the lock file, compact and repair the Back end and it will work just fine until the next corruption, and the data that was attempted to be written is there, so there has been no Data loss.
The back end data was rebuilt last year to remove the random primary key values, that were created when the database was replicated over a dial up modem back when the database was first developed. The replication functionality was turned off approximately 17 years ago. The back end has been rebuilt again from scratch, each table was created in a new Database and all the index's and relationships were rebuilt. The data from each table was exported to a Text file and then imported into the new database.
There were no changes made to the front end in the prior three or four weeks before this issue started happening. Just to ensure that it was not something in the frontend, it was rolled back to a version that was working fine in February of this year, unfortunately that did not resolve the issue
None of these steps have resulted in resolving the back end corruption, and if anything, the corruption is happening more frequently. The only thing that works at this point is to have one user at a time in the database, as soon as the second user opens the frontend, the back end will corrupt within a few minutes.
Any thoughts or ideas would be greatly appreciated.
Thank you
Steve Brewer
Update:
This is a known bug introduced by one of the Office/Windows updates. See http://www.devhut.net/2018/06/13/access-bu...ognized-format/ for all the details and workaround/solution.

MS Access occassional "Cannot open any more databases" error

I have an MS Access (2013) application with a split database. Everything seems to run smoothly except for occasionally I will get Error 3048: Cannot open any more databases.
The error occurs when the front end tries to run vba code which involves pulling data from the back end and will stall on any line with: Set DB = OpenDatabase() or DoCmd.RunSQL() commands.
The strange thing is that this error seems to be time based. I can access the back end hundreds of times without error if I do it quickly enough but after some time has passed (~1 hr) the error shows up. In fact, I can open the application and leave it running in the background (with no code running) then go back into it after an hour and I will get the error the first time the code tries to open the back end.
I've searched the length and breath of this site and google for solutions so I know this error has been addressed before. To save people reiterating the usual fixes I will list what I've tested for so far with no success:
Recordset limit: I'm not leaving any recordsets open, every time I open one I make sure to close it. The same for the databases. All my requests
to the back end are done via 3 or 4 vba functions and each of these has
a Rec.Close or DB.Close corresponding to every OpenRecordset()
and OpenDatabase() and I never have more than 2 recordsets open at
a time.
Control limit: I have 151 controls on the biggest form in the application so I should be below the limit (I believe this is 245 for a single form?)
Corrupt database: I've copied all my forms and code to a new Access database and run a Compact and Repair.
Machine Issue: I've tested the application on several machines and reproduced the same error.
Anyway with most of the above situations I would expect the application not to run at all, instead of running fine for a set amount of time and then crashing.
Some other points of note:
Citrix Users: The users are split between normal windows machines users who are experiencing this error and others who are using the application through a virtual desktop software (Citrix) who are having no issues. Unfortunately I don't know enough about this virtual desktop to really work out what that implies.
Background vs Foreground: Some users have claimed that the application only crashes if it has been running for a long time AND they switch over to another program and switch back. I've confirmed that simply switching between the application and other programs doesn't cause it to crash but haven't yet been able to leave it running in the foreground long enough to confirm if it crashes without switching between programs.
I've been struggling with this for days, anyone able to help me out?

Microsoft crash upon reaching "End Sub" in VBA for MSAccess

I'm having a problem with a form that adds a source association to a company record. In the main form, the user specifies the source name to be associated, and then this form opens to allow the user to confirm the name, and pick a year, if that name has more than 1 year associated with it. When the user clicks on "Continue", the code checks if the association already exists, whether the source has multiple years, and if so, if the user has selected which year to put with the associated name. When there are not multiple records (ie the name has only one year,) the continue button works just fine, but when the user has to pick a value of the year, the continue buttons works fine and does its job, entering the new association into the database, until it gets to the Exit sub line under the Exit_cmdAssign_Click line, and then the whole Access stops. I get a message box saying "Microsoft has stopped working", it backs up the database and eventually reopens it. At one point, as it stopped it gave me an option to debug in Visual Studio, but there, there were problems finding necessary files for the debug. Before I tried to debug, it said, "An unhandled win32 exception occurred in DWWIN.EXE [8940]."
Does anyone know how an exit sub can cause such a crash when one extra variable is included in an equation, which actually performs as it should, but then seems to cause problems exiting the sub?
Crashes of Access are not regular errors that you can fix by changing your VBA code. No matter what your code is, under no circumstances should this happen.
That said, from time to time Access does crash. Most of the time the cause lies in an inconsistent compilation state. That can be easily remedied by decompiling the database. Follow the instructions over here: https://stackoverflow.com/a/3266849/6216216
And make sure you have a backup copy of the database before you decompile.

VBA code rushing on debugg mode while interacting with SAP

I'm having some issues with my code that I wasn't able to find anywhere.
Issue: While debugging my code, running it line by line with F8 in Excel, at some specific points excel does not wait for the application with which it's interacting to finish and proceeds to execute the rest of the code.
What is the macro: It's an a macro to automatically input information on SAP, in this case VA02. I do belive that this question is more VBA related than SAP related thus I'm posting here and not on SCN.
Where the problem occurs: The issue only happens when I'm changing the partners numbers in the Partner tab(either header or line item level). I've also saw this happens whenever I was trying to add something on the Conditions tab.
What error does it cause?: None, that's the odd part. While debugging, after I execute the line to change the Bill to Party for example ( Only change the number, no Enter or any other key is send) the code keeps running and execute the next lines. The even more off thing is that SAP seems to still be processing some of the changes but the VBA code keeps running without errors, meaning that SAP is not on the screen its showing.
So, if there's no errors what you want?: Well, while in regullar run mode it work flawleslly, this issue really makes it very hard to debug, forcing me to put a breakpoint in every... single...code...line...
What have you tried?: I've looked into Async and forced sync, no avail. Also looked in something related to Background Refresh but I guess that's only for query connections, I tried it with SAP GUI connection but also didn't worked.
Hope anyone can shed some light on this subject, maybe saw this previously. I will try to test on a peers computes but didn't had the chance yet, will post my findings after.
Thank you for reading and maybe replying =)
This is just a pice of the code as it's huge, I've noticed the problem is different parts, always the part that's inputing info on SAP. My peer write similar codes, that do the same thing on the same fields and he never got this erro so I think it might be related to excel somehow
'Bill site
Connection.findById("ses[" & Sesn & "]/wnd[0]/usr/" & ref & "/subSUBSCREEN_PARTNER_OVERVIEW:SAPLV09C:1000/tblSAPLV09CGV_TC_PARTNER_OVERVIEW/ctxtGVS_TC_DATA-REC-PARTNER[1,1]").Text = Dwks.Cells(2, "N")
For this program the erro usually start on this line, but on other ones i've seen it start on different ones. There's nothing special about this code line, i've used it many times. What comes before it is also pretty standard, just the SAP connection. I'm avoiding post the code here because I'm sure that this is not the cause of the problem, is the same sintax i've always used, with the same elements. This is something excel related.