VBE & Access Freeze When Opening Forms in Design View

73 Views Asked by At

I've lately been observing that Access and VBE hang for 5-10 minutes when opening a form in Design View. During this time, the application shows as not responding in Task Manager.

This does not occur if the VBE is closed when opening a form in Design View.

This does occur when:

  • The VBE is open and in Access, I open a form in Design View, by either (a) right-clicking on the form icon in the Navigation Pane or (b) right-clicking on the form's top tab when the form is open and selecting Design View.
  • A form isn't open in Access but on the first keystroke when I edit the form's module in VBE.

The following have no effect:

  • Decompiling;
  • Decompiling and then compiling;
  • Decompiling after deselecting all AutoCorrect option boxes.

The behavior is identical for bound and unbound forms.

Google doesn't have much on this. Any thoughts on why this might be occurring, how to debug it, or how to fix it would be most appreciated.

2

There are 2 best solutions below

0
ebsf On BEST ANSWER

It turns out that the cause of the problem, however bizarre, is the specificaton of the system's default printer.

The freeze has been on a laptop the default printer of which had been configured to be the printer connected to my Samba / CUPS server at home, to which the laptop has not been connected when I have observed this behavior. Changing the system's default printer in the Control Panel to a local PDF print driver eliminated this freeze and other freezes I had been experiencing with other apps.

System or file corruption had nothing to do with this. I had ruled this out via various repair utilities of Windows (dism, sfc) and app installers.

I stumbled into this solution while investigating similar freezes with other apps, in a very brief post giving no explanation, in a lengthy thread otherwise clogged with pseudo-experts bloviating about system reinstallation.

No telling why the default printer spec would trigger this problem. Having discovered the solution, I googled "windows freeze default printer" to see whether this is understood. It seems, not. My impression is that print-related freezes have been observed for a decade or more, and no understanding yet exists about the cause or solution. Most or all of the advice is irresponsible recommendations of system overhaul or reinstallation, all of which likely are an utter waste of time.

Having the solution but no understanding of it, any insights I'm sure would be well received.

0
ebsf On

[Edit: This isn't the solution. See the next post.]

The solution, thanks to @Andre and as described in the comments, is to open a new blank database and then import the relevant objects from the old database. Again, as noted in the OP, decompiling the old ACCDB file had no effect.

I performed the import using the GUI (External Data > Access > Import tables, queries, forms, etc.) instead of using the well-known but undocumented Application.SaveAsText and Application.LoadFromText methods. Chiefly, this was a matter of time efficiency because my version control code library doesn't yet fully implement the latter.

Having imported the objects, I added the necessary VBA library references in the VBE, compiled and saved the project, linked to the back end, and was back in business with no sign of the freezes described in the OP.

The new front end file compiles to ~20MB whereas the old one is ~29MB. This tells me the old one is cluttered with vestigial objects and compiled code not cleared by using the msaccess.exe /decompile switch.