Form Opens And Form Closes

  • Thread starter Thread starter Jim Jawn
  • Start date Start date
J

Jim Jawn

I have an application with 7 main forms, but my application keeps crashing
when I use a large number of docmd.open's and docmd.close's. In one
particular form, every 19th time I click on the "open form" button, the
application crashes and I get one of 1000 assorted error messages. From
what I can tell by searching the internet, this a memory issue. As a
result, I've started loading all of the forms on startup and using the
visible true/false property. I can get all of the main 7 forms open with no
problems and the application is noticably faster now as a result.
However...

In one of the 7 forms, I have a list of all of the "prospects" in a
continuous form with a "view" button that opens up a "Detail" form.
Previously, I would have used this...

DoCmd.OpenForm "frmProspectDetails", acNormal, , "PID = " & lPID,
acFormEdit, acDialog

But because the application keeps crashing after 19 records, I need to find
another way to accomplish this.

I would like to find out how I can make "frmProspects" visible AND move it
to the ID by using the "view" button. I'm stuck. I've tried using a
filter, but I can't seem to get that to work. I've also tried setting a
public GetID function and moving it to the correct record, but I can't seem
to that to work either. I'm looking for any help I can get that could point
me in the right direction. Thanks for your help.

Jim Jawn
 
This whole post makes no sense at all.

To have some error due to simply opening some forms a few times means that
something is seriously wrong here. Either your office install is bad, or
perhaps for some strange reason you are running the application without the
latest service packs and updates installed.

To start re-writing the application to keep the forms open is most certainly
a case of the cure doing more harm then good. It is rather a harsh approach
to this problem.

If something is so un-unreliable right now, then trying to patch this up by
keeping a form open is a formula for complete and utter disaster. How can
you be sure you will get any kind of reliability by using this approach? You
need to step back, and take a look at what is going on here. I would not
accept an application that dies after 19 forms loads. In fact, I would fire
the developers and anyone else involved on the team that even REMOTELY finds
this acceptable. It is a really bad idea to patch this up with out some
serous thought here.

It is very possible you are trying to accomplish something outside the
abilities of ms-access. I simply don't know, but I do know that if something
dies after 19 form loads, something completely wrong here. So wrong is this,
that I would not attempt some fix via keeping a form open.

Software development is a funny thing. Of course if you have ever used a
buggy application, if you go and ask the developers,they will blame their
tools, or the OS (the developers NEVER admit fault!). When software is well
written, then you kind of "feel" and know when it is going well. Some
applications are rock solid, and those others if you cough the wrong way the
whole thing comes crashing down (yet both appcltions where written using the
same tools!).

It sounds like your application is extremely flaky right now. You need to
make a decision here as to what is this source of problems.

You should take look at that problem form and try and figure what is wrong.
Perhaps it has a graphic background, or even is loading a large picture into
a image control (both of these can really cause problems in ms-access).
Perhaps you have some reocrdset code and don't close your recoredsets and
set them to nothing?

I have appcltions were the users open and close forms hundreds of times per
day. In fact, with a fairly reasonable sized customer base I NEVER
experienced your problem.

You also don't mention what version of ms-access, and what sr updates and
realising you have installed.

The first thing I would do is install both the updates to office, updates to
JET. I would also consider installing the update to your OS also, but
really, the office and the JET updates are a must.

After that, I would start looking at his problem form, and try and figure
out what is going wrong here.

It is really frustrating to have the kind of problem you are experiencing. I
know you would rather spend time just working on making the appcltion
better in place of having to dodge a bullet. However, I would take the high
road, and start looking for a solution to improve reliability. It may very
well be that you exhausted every other possible means, and the keeping the
forms open is the last resort. (I hope that is not the case!).
 
Albert:

Thanks for you reply, I appreciate it. The inherent problem is this: Just
one form crashes every 19 times it loads. The other forms crash between 60
and 70 clicks each time and each time, its the same error message: Run-time
error '2004' You are out of virtual memory, try increasing the page file
size the first 4 times they crash. After that, I get a bunch of different
messages. Sometimes its "'' is not a valid value". Sometimes its "Cannot
find the field 'xyz'". Other times its "Cannot locate control 'xyz'" The
only thing these errors have in common is that they always happen during the
60 - 70 clicks on the forms or the 19 clicks on the form I originally
complained about.

I'm working off of Windows 2000 Pro with 316MB of RAM and the first thing I
did was download all of the latest updates. I downloaded service pack 4, IE
6.1, the latest version of the Jet engine and any other microsoft
recommended update. I'm also using Office XP, so I checked out what update
version I was using and went to office update. I'm running Office XP
service pack 2 and all of the updates from officeupdate.com are loaded on my
computer. This was the first thing that I did.

Next, I did some research on the error message and I found some info here
http://www.barback.com/support.htm which in turn led me to
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q253912. Now I
wasn't too convinced that this was the problem (mostly because I'm running
W2K Pro, so i checked all of my code. I checked all of my recordset
objects, connection objects, arrays, globals, publics and constants. I
rewrote all of the code that i could find that I felt was using too much
memory and wrote some error message logging routines. The errors keep
happening on the same DoCmd.Open event on different forms, but they contain
the same messages. Run-time error 3011, Run-time error 2004

I am using bitmaps in my application and I've read that access has had some
problems working with images in the past, particarly jpgs. I still haven't
removed the images, I'll probably try that today.

The reason I posted my previous post was because, I had read in the Access
2002 developers handbook, that one way to make your forms more efficient is
to load them at startup and keep them hidden, using visible true/false to
control the way the application works. So I changed it. After I changed
the events from DoCmd.Open to visible = true, I could click on the same form
that was crashing every 19th time 300 times without any problems at all. It
seemed to fix my problem. I've gotten to the point that with all my forms
and my deadline to get this app working,

I understand exactly what you're talking about in regards to putting a buggy
app out there. I don't want to do it. I want to make sure that everything
is smooth and works correctly, but time is of the essence. My ultimate
object is to port the application over to SQL with a middle tier and web
front end. I probably should have started that way, but I didn't, so now
I'm forced to fix this as quickly as I can and use it as a prototype for the
next application.

Thanks for your reply, I do appreciate it. I'll check out the images today
and see what's happening and if that fixes my problems. Any other
suggestions you may have would be greatly appreciated. Thanks for you help.

Jim Jawn
 
Thanks Ben. That gives me a few ideas. I'm not used to using the filter
function either. I'll find out more in google. Thanks for the heads up.
 
Just wanted to post an update on this and perhaps ask for a couple of
suggestions. After setting up a test form, it turns out the the real
problem is actually the number of recordsets that I can open. By
eliminating each bound combo-box on the form, the form would enumerate an
open and close event more frequently. Jet 4.0 supports up to 2048 open
recordsets at any given time, apparently, I'm using much more than that.
Therefore, I'm redesing all of my queries, forms, etc. to minimize the
amount of data I have open at any given time, which leads me to my next two
questions.

(1) Is there any way to load a recordset on startup and save it in memory,
load multiple combobox's with that recordset, and just use the id stored in
the table to set the selected value of that particular combobox? For
instance, I have 16 combo boxes with time in 15 minute intervals spanning 24
hours as their data source. There are two boxes for open and close times
for each day of the week and holidays. What I'd like to do is load one
recordset in memory, use that recordset to populate each combobox, and set
the selected value. This may not be the most efficient way to do this, so
any suggestions would be greate.

(2) Is there any way to load a subform on a click event? I'd imagine its
possible, but I'm not sure how to approach this.

Thanks,

Jim Jawn
 
Back
Top