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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error! Out of Memory Visual Basic 1

Status
Not open for further replies.

jlitondo

MIS
Jun 27, 2000
175
US
I have an Access database that worked fine untill out of the blue I started getting the following VB error "Out of Memory". This pops up whenever I open a form and run it, then set that form to desing view and try to access vba code behind the form. Has anybody experienced this error before? If so, please let me know what causes this.
 
can you save the form as ascii, check the text, and then recreate it from that?
 
I tried saving the form as ascii but did not find any options for that. Also, it seems like its all the forms now. I rebooted my machine and started the MDB afresh but as soon as I try to go into the code I get the error and the code editor does not load.Neither does the help menu. I'm also getting a message telling me that 90% of my resources are in use. Is there a way that I can check to see what is taking up so much of memory?
 
What Windows version is insaled on your computer? If it is 98 - just throw it out,it works disgustingly with VB. I remember this error message very well.
 
This discussion has appeared in the VB6 forum more than once in the last few months.

The #1 problem was too many controls on a form. Microsoft claims the maximum number of controls that can be placed on a VB6 form is 255. If you are certain you haven't exceeded this number, never mind. Otherwise, consider the alternatives: eliminate all unnecessary controls, move some controls to another form or place similar controls in a control array (You can use many more than 255 controls on a form when they are in an array. Due to the extra programming, leave this as a last resort.)

#2 Problem: inadvertent recursion. For example, you have code that modifies the contents of a text box in the text box change event. It won't take long to hog 99% of system resources and run out of memory (if you are low on disk space) on a Win9x system. There are countless ways that this bug can appear in an application and none of them are easy to track down and kill. Check the events on all forms and controls. Make sure that you haven't created a "feed-back loop".

#3 Problem: corrupted form. If you are using VB 5 or 6 your forms will be saved as ASCII text. If you can't find an easy way to view the forms outside the VB IDE, use the MSDOS editor. Shell to DOS, enter EDIT and open the suspect *.FRM file. You shouldn't see any extended ASCII characters in the file. If you do, depending on the context, you may be able to delete them and use Mike's suggestion to recreate the form.

My suggestion would be to go through each form until you find the problem. Create a new project. Place a button on a form and add code to show a form. Add your modules, if any. Then add the first form to the project, changing the code in the button to show the form according to its name. Run the project and click the button. Make note of every error, especially errors that reference subs in other forms. Comment-out each error line and restart the project.

Repeat until there are no error. Remove the form from the project (make sure you don't save the changes!) and then add the next form and repeat the process.

Debugging the "Out of Memory" error can be very time-consuming. In the end, you will find it quite gratifying.
doom2.gif
 
Oh Ya! You guys are awesome. First of all, I do have some forms with a lot of controls on them. Secondly, I have a lot of code which modifies these text boxes on the forms.Thirdly, on compiling the code, I get an error message that references a procedure on another form (decided to debug this late).
What I did is put unbound controls over my bound regular controls on a form. OnLoad of the form, code hides the bound text boxes and makes visible the unbound ones. The effect of this is that the user sees the form loading up empty. OnClick of a Combo Box selection, the unbound controls are hidden and the bound ones made visible. I did this because I tried setting the bound controls' text property to vbNullString but it appears that that made Vba think that I am nulling the field that the control is bound.Is there a way to go around this? Unfortunately I will not be able to go into my project this weekend to resolve this but I will be popping in and out of this forum.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top