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

Not enought memory error when opening a form 3

Status
Not open for further replies.

Mayhem9

Technical User
Dec 19, 2009
155
AU
Hello,

I have been working on a form and now I am getting a "There isn't enough memory to perform this operation..." error.

I am running 4GB of RAM and have no other programs running and have closed down all the sleepers in the system tray. Task manager shows 3% memory use. Opening other forms are fine and I can open the relevant table as well.

I have tried double clicking on it, opening in design view and even tried using a macro. All result in the same error. When the form is highlighted and I click on the code icon in the menu bar, I get the same error. However, If I open up a module I can then open the code.

So far I have tried the following:

1 - Compile the code (no errors)
2 - Compact and repair database
3 - Detect and repair
4 - Bad language

None are working - any suggestions?

Cheers,
Darren
 
Create a blank database. Import everything but the problem form. Compact and repair. Compile. Rebuild the form.
 
Thanks MajP,

I'll do that. Just out of curiosity, why does this happen and does it happen frequently? How often should a db be compacted, repaired and compiled?

Cheers,
Darren.
 
When I write code, I compile before ever running the code. This will catch all errors. When I develop a database I regularly import all objects into a clean database (always before working use). For most of my databases I compact on close; however, I do not know what are the draw backs of doing that. I guess I should post a thread and find out.

Access databases do get corrupted, but not that often. Compile your code and compacting helps. Importing into a new database regularly helps. It is like cleaning the registry.

When a database gets corrupted it is usually in the forms. If the form is very complex and you do not want to rebuild it, then look at decompiling it. You can search this site on decompiling a database. If it is not complex, I would go right to rebuilding it.
 
Hi MajP,

For most of my databases I compact on close

Is this something that can be automated?

I had been playing round with the form to see if I could place the image frame into a Tab Control with 4 tabs"
1. image (show for all)
2. additional image
3. technical data (a link to pdf/jpg exploded diagrams etc)
4. instructions (as above but for manuals)

Tabs 2 - 4 would only show if there was data but then not sure how to add the data! Probably a form just for this now that I have a great search function (that I still don't understand). I am using some of the code already utilized, so perhaps I stuffed something.

Making small steps but I might develop it outside of the main form first.

Cheers,
Darren
 
For most of my databases I compact on close; however, I do not know what are the draw backs of doing that."

The main drawback is that, ironically, Compacting has been cited as a cause of corruption. Because of this, you really should make a backup copy of the app before Compacting.

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Compact on Close" is a settable Option. It is different locations in A2007 and prior version. Read help on how to set.

The tabs are called "pages". They are numbered starting at 0 or you can refer to them by name

tbCtlOne.pages(1).visible = true
tblCtlOne.pages("SomeName").visible = true

If you want something to happen when you move to a page use the tab controls on change event not a page click event. If I move to the second page (index = 1) the value of the tabCtl becomes the page index.

private tbCtlOne_Change()
if tbCtlOne = 0 then
do some code for page 1
else if tblCtlOne = 1 then
do some code for second page
...

end sub

So if you want to show pages ... only if there is data

form_current
if not isnull (me.techdrawing) then
tbCtlOne.pages("pgTechDrawing").visible = true
else
tblCtlOne.pages("pgTechDrawing").visible = false
end if
 
Hi MajP,

Thanks for that, I'll see if I can get it to work.

I have just completed the new database, export working bits and then recreate the Tool_Log form and had it happen all over again (insert expletives). So more playing around I think.

Cheers,
Darren
 
Hi Missinglinq,

Sorry - missed your post - thanks for your rsponse. I have an automated back-up system, which is good for me but I wonder how likely a backed-up version is to fail if the working version fails? After all, once the database is set up and functioning the amount of modification should be minimal (hopefully none).

Cheers,
Darren
 
Missingling,
That would have been my assumption, or they would do it automatically. Do you have any good references on that? However, for years I have been doing this on shared databases and have never seen any issues. I always assumed that issues might arise, but they never have. I guess the likelihood is very low but the consequence is high.

Mayhem,
It sounds like the form may not be corrupt, but it is some code you are running. Can you post the problem db?
 
Thanks MajP,

It is 2am here and I keep getting stuck on the same thing. Some of the combo boxes in the form that I have imported to rebuild are from when the look-up tables had an autonumber PK and when saving the form after fixing is resulting in Access stopped working!

I also posted this before but it seems to have been lost in the ether!

The code looked OK after I fixed a couple of bits and compile didn't show any errors.

Please let me know if you would prefer to wait until I rebuild the form from scratch, as that is possibly the best solution. Otherwise, what I have is here:

Tool_Log form working with bad look-up table ref
Tool_Log ERROR is the cause of this thread!

Cheers,
Darren.
 
That form is toast. You may be able to decompile. If not here is a fixed version.

As you develop a database always version number. Save a backup periodically and increment your development copy. Also you may want to consider reducing the width of your tool log. If you are going to have other users, this will not display well on a laptop unless you have really high resolution. I usually design in 1024X768.

 
Hi MajP,

Thanks - I have downloaded the file and will work on this when I get home and see if I can decompile it. I usually save copies of the db into a folder called archive and save them by date with a comment. I think I got excited somewhere along the lines and forgot! I have all the code for various components stored as text files, along with notes on how to do things, so it isn’t the end of the world if I have to start from scratch.

I probably should start looking at posts and documents on these sorts of considerations and conventions, such as naming items etc before building. I note a lot of people give items a prefix based on their type (e.g. tblABC or frmXYZ). I assume this is a standard. I’m sure there are a multitude of such conventions that make life easier.

I take your point regarding design and it is something I was aware of, as the machine in my workshop is 1024x768 but I am building it on my laptop, which has a wide screen. However, it is something I will probably do a little later, once I have things working (after all, I may make it a multi-page form with just the data fields on page 0 and the image on page 1 and so on). Just quickly - is there any way to set the resolution or is it just done by working on a set screen size? I will be the only one using it but a friend of mine also wants a copy, so it is something I should do

I also need to do some more reading on how to get the forms to open in a set position. Mine seems to move a little every time I open it. From what I have read so far this seems to be an issue for others too.

Thanks again for all your help – it is greatly appreciated.

Cheers,
Darren
 

Here is the Mother of All Search Forms.
1)You can sort the list by any cagegory
2)Filter the list by any category
3) Do an And or Or filter
4)Choose to return a filtered set or go directly to a selected record.

I think this will become my gold standard for future developments.
 
Thanks MajP,

That is certainly a search form worthy of gold standard status. I can hardly wait to import the 1000+ items back into the db and put this to good use.

I have set my laptop to 1024 x 786 and I am rebuilding the main form from scratch. I will still try the decompile when I have sufficient time to dedicate to it. I did open the db at work on a desktop machine set to 1024 x 786 and I can see what you meant by you comments - it looked like Fisher Price made it! I'm not sure if there is an easier way to do it but adjusting the screen res seemed easy enough.

Once I have the form sorted I will back it up before trying new mods and I think I will limit myself to one mod at a time!

Cheers,
Darren.
 
There is some code and a free downloadable version to automatically resize form based on screen resolution.

I find it works "OK" but never a hundred percent. Unfortunately if using this you should design at a low resolution and it will stretch to the high resolution. Does not work well in the other direction.

1024 X 768 is a little low, but the older guys around the office prefer that resolution.

Once you get done and before importing all of your data you should consider splitting the database.

Put only the tables in one called the back end
Put all forms, reports, queries, and code in the front end.

Then the front end links to the back end.
Now you can put the back end on the server and each user has a desktop front end. Each user can work in the db at the same time.

This also allows you to keep designing the front end without having to take the database off-line. That way you could have both a 1024X768 version and a 1280X1024 front end and you could pick which one depending on lap top or desktop.

You may want to split it even if it is not multi user when working with a lot of data. If anything get corrupted just roll back to a prior front end without worries about losing data.
 
Thanks MajP,

I'll look into that. I actually don't mind the smaller res on my laptop. It makes it look a little more professional. I have never split a db before, so that will be something else to try. I am keeping a list of what to do and what features I would like and I will try to tackle them one by one now. Had an issue with getting one feature to work on the main form that I am building from scratch, so that is my first challenge. I am going to nut this one out myself (I hope) and only post for help if I really cannot do it.

Cheers,
Darren
 
Good luck. We will be here if you get stuck. You seem to be tackling a big db, and seem interested in the more advance features. Do yourself a favor and invest in some reference books. A picture is worth a 1000 words, so you will save a lot of time in the long run. You do not need to get the most current 2007 versions. Go on line and get some used books, you look around there some out there dirt cheap. I would recommend

Access Inside Out (I have 2003)
and after that
Access 200X DeskTop Developers Handbook by Litwin, Getz, Gunderloy

This is how I taught myself how to develop Access apps.

I reference mine all the time.
These are all good

You should be able to find used ones for under 10.00.
 
Thanks MajP,

That is very helpful & I will certainly look into those

Cheers,
Darren
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top