Microsoft Access Closes unexpectly

Copper Contributor

Microsoft Access is closing unexpectedly. The strange thing is that sometimes the forms I have designed work correctly and other times the program closes unexpectedly. I think it has something to do with the programming done and updates made to Access.  I use a lot of DAO to create new records, consult them, validate and so on. Before, this only happened in one form, but now it happens in 3 different forms. I have the tables in one database and the application in another, so the tables are attached in the application. I have found some tricks to try to stop the application from closing. For example, there is a form of all the products, in which I can do a search by the name of the product and when selecting the product in a combo box, I execute code to go to that product using DAO. If I open the product form and immediately search for it, the application closes. Instead, if I open the form and then go to the last product and then go back to the first (with the navigation buttons) and then search for the one I want, most of the time the application does not close. But it doesn't always work for me and it's kind of tedious to be doing this. On the other hand, there is an order form that after having added products causes the program to close, however the data has never been corrupted or lost, that new order is simply blocked and I must manually modify the table to be able to unlock the application, otherwise when I select that order the application always closes

4 Replies
Same problem. Access is closing whenever I Edit a VBA code.
Thanks for your help.

@Beno9 It's not clear. Are you thanking the original poster? Or are you asking for help for yourself?


If the latter, we need a lot more context before we can offer any suggestions beyond the generic ones.

Make sure your code compiles. Make sure all variables are defined. Make sure EVERY module has Option Explicit at the top. Compact and Repair the accdb. Do NOT try to edit VBA in break mode.

Many thanks for your message. Being new to Tech Community, I have noticied your reply lately. I am asking for help for my self. I have almost the same problem as LeonelSantizo, therefore I thought it would a good idea to join this post instead of opening a new one.
Concerning the shutdown of MS Access whenever I edit VBA, the Option Explicit is added, Compacting and Repairing the accdb is done, but the problem is still there. There is no single error in the forms, tables and queries that I have created. Macros run smoothly.
No VBA code yet. I am using Office 365 family subscripton, multiple languages on Windows 10 Pro up-to-this-date.
Do you have any idea?
The problem has been resolved in my case by changing Country and Regional Format in the setting of Windows 10 to the desired language.