Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Out of memory error in Access VBA editor

Status
Not open for further replies.

TimGoff

Technical User
Jul 16, 2002
166
GB

Hi

I have a fairly large Access db (about 1GB) that has been working absolutely fine. Now everytime i attempt to edit some code, or insert new code it deletes the line and gives me an 'out of memory' error

Looking at the help it says reduce the amount of public variables - I have 10 of them

Could anyone shed any light ?

Cheers
Tim
 
Though I try to avoid public variables, 10 won't kill an app.

Since 1GB is only half the limit, that shouldn't be the problem either, then let's round up the usual suspects

1 - though the aout of memory error probably doesn't relate to this, the behaviour of deleting lines/letters in the editor can occur based on having a form open which utilizes the timer function

2 - some hardware related stuff related to your computer or network

3 - some kind of corruption - there shouldn't be anything stopping you from at least trying some of the tips and tricks for working with corrupted dbs - start with taking some copies of the db, and keep the original, in case you'll need professional/paid assistance.

Here's some text I'll sometimes drop into threads were I suspect corruption might be an issue:

"This faq Corrupt Microsoft Access MDBs FAQ has a lot of info concerning corruption, symptoms and how to deal with it. MakeItSo's FAQ705-4683 also has some recommandations.

During the last years, I've resolved all my code corruption issues using the /decompile option, in stead of importing objects. It's described here Decompile or how to reduce Microsoft Access MDB/MDE size and decrease start-up times

Here's also an option that might provide some results on exporting/importing database objects Thread705-834817."

There's also a utility which is downloadable from Microsoft called JetComp (which I've never tried)

Roy-Vidar
 
When you are in the VBA editor, close the code windows for any forms, modules, classes, reports that you are no longer working on. If you leave them open, then close the database, the next time you open the database and go into the VBA editor it loads each of these code windows again. Each one takes up some memory.

I've inherited databases from programmers who never closed these windows, and when I opened the database I would recieve "out of memory" errors. As I closed the 50 or so code windows, I could see the memory getting reclaimed.

This was with Access2000, I don't know if this issue has been resolved with 2003 - but it's worth checking.
 
First time I have heard about that you need to close the code windows.
I tried that on one of my programs, closing all windows before closing the program. But when I open it all the code-windows were also opened.

I use Access 2000.
 
I think you need to make a change, like adding a blank line. Then close all modules, then save your changes (doing a compile would probably be good to). The next time you open your code editor the modules should be closed.
 
Yes, that worked.
Now I have lots of work to do.
I manage 30 Access programs and I'm working with code all the time.
So now I need to make sure that I close every window from here on. :)
 
In this post:
"Out of memory" msg with Win98/Access 2002 & VB editor
thread705-712053

DeanWilliams shows how to close all code windows.
 
How are ya TimGoff . . .
Rrealize your talking a [blue]Memory Resource[/blue] issue here!

I've had the same issue with db's as small as 200MB, but that 200MB cromprises mostly code!

When this problem arises I simply close all code windows except the one I'm working on . . . Has worked everytime!

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
Hit submitt too soon!

First place to look is [blue]any other major applications running at the same time![/blue]

Calvin.gif
See Ya! . . . . . .
 
This is DeanWilliams' code:

Code:
    Dim intWin As Integer
    Dim intCount As Integer
    Dim intCur As Integer
    
    intCount = vbe.CodePanes.Count
    SysCmd acSysCmdInitMeter, "Closing VB Windows...", intCount
    
    For intWin = 1 To intCount
        vbe.CodePanes(1).Window.Close
        SysCmd acSysCmdUpdateMeter, intWin
    Next intWin
    
    SysCmd acSysCmdRemoveMeter
From: "Out of memory" msg with Win98/Access 2002 & VB editor
thread705-712053



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top