Vb.net – Insufficient memory to continue the execution of the program

ms-accessvb.net

My Application (Vb.net, Access 2003/2007) is to scan Access Database files for activex controls and to generate report accordingly.

Problem:

Getting an error like:

"Insufficient memory to continue the execution of the program."

The above error occurs while scanning for older version of Access files like prior to office 2000.

And the line of code where I get this is as follows:

Dim oForm As Access.Form
Dim oAccess as Access.Application

oForm = oAccess.Forms(objForms.Name)

But it opens the file and form as well.

Need Help:

Whether it is possible to read the file (Access Forms and Reports) or not?

Please provide me reference or any solution.

Best Answer

You appear to doing COM automation of Access to open the forms and then cycle through their controls looking for certain properties.

Another solution would also involve automating Access, but it wouldn't require actually opening the form, and that's the undocumented Application.SaveAsText command. You'd do something like this:

  Application.Saveastext acForm, "dlgWebBrowser", _
    "C:\Output\dlgWebBrowser.txt"

You would then have to figure out how ActiveX controls are described in that file. If that file looks like the code for a VB form, that's because that's precisely what it is.

The example above had an IE web browser control on it, and after a dump of OLE data, it had this in it:

  OLEClass ="Microsoft Web Browser"
  Class ="Shell.Explorer.2"
  GUID = Begin
    0x54c1ea41936d2046b9dc5b29905976e3
  End

I would expect that all ActiveX controls will have an OLEClass, but I non-native avoid ActiveX controls on principle because of the problems they can cause if not properly installed when you try to run the app.

In fact, that could be the source of the problem -- if you open the Access form on a machine that doesn't have the relevant ActiveX control registered, it's going to fail, and the form won't open.

My bet is that Application.SaveAsText is going to sidestep that problem entirely, since the form doesn't have to be opened.