473,320 Members | 1,887 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Instance of Access hangs


Hello all,

I've been working on a VBA application in Access for a few months now. This
morning, my Access application began to hang in memory, using 97-100% of the
CPU, and the only way to remove it is through the Task Manager. I'm using an
Application.Quit command, which worked fine yesterday, but doesn't close the
instance anymore.

I googled and wasn't really able to find anything that helped with this, so I
thought I would just ask a couple of general questions so I would know what
to look for in my code.

- What causes an application to hang in memory?

- Why is it using almost all of the processor, when I can find no
processes that are running from my program?

It might be worth noting that when the Application.Quit is called, my program
shuts down and Access minimizes. When I re-maximize, it shows an empty
screen, like after you close the database window.

Any help would be greatly appreciated - this is driving me up the wall.

Thanks in advance,
Nick
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200507/1
Nov 13 '05 #1
6 7284
Br
Nick via AccessMonster.com <fo***@AccessMonster.com> wrote:
Hello all,

I've been working on a VBA application in Access for a few months
now. This morning, my Access application began to hang in memory,
using 97-100% of the CPU, and the only way to remove it is through
the Task Manager. I'm using an Application.Quit command, which
worked fine yesterday, but doesn't close the instance anymore.

I googled and wasn't really able to find anything that helped with
this, so I thought I would just ask a couple of general questions so
I would know what to look for in my code.

- What causes an application to hang in memory?

- Why is it using almost all of the processor, when I can find no
processes that are running from my program?

It might be worth noting that when the Application.Quit is called, my
program shuts down and Access minimizes. When I re-maximize, it
shows an empty screen, like after you close the database window.

Any help would be greatly appreciated - this is driving me up the
wall.

Thanks in advance,
Nick


What are you doing in code before trying to quit? Are you setting things
like Set myRS = Nothing ?

Could be corrupted... try repair/compact, try importing all your objects
to a clean database...

Is your database set to compact on close?

--
regards,

Bradley

A Christian Response
http://www.pastornet.net.au/response
Nov 13 '05 #2
The high processor usage can be ignored, Access is designed to grab as much
processing power as it can get, but readily yields it when other apps need
it.

The most likely reason why it hangs is because you haven't destroyed a
pointer somewhere.

The trick to finding why this happens is
a) Find the minimum steps required to cause the application to hang
b) Step through the code used by the minimum steps, ensuring that you
set all object variables to nothing and close all recordsets or connections
that you create.

--
Terry Kreft
MVP Microsoft Access
"Nick via AccessMonster.com" <fo***@AccessMonster.com> wrote in message
news:51***********@AccessMonster.com...

Hello all,

I've been working on a VBA application in Access for a few months now. This morning, my Access application began to hang in memory, using 97-100% of the CPU, and the only way to remove it is through the Task Manager. I'm using an Application.Quit command, which worked fine yesterday, but doesn't close the instance anymore.

I googled and wasn't really able to find anything that helped with this, so I thought I would just ask a couple of general questions so I would know what to look for in my code.

- What causes an application to hang in memory?

- Why is it using almost all of the processor, when I can find no
processes that are running from my program?

It might be worth noting that when the Application.Quit is called, my program shuts down and Access minimizes. When I re-maximize, it shows an empty
screen, like after you close the database window.

Any help would be greatly appreciated - this is driving me up the wall.

Thanks in advance,
Nick
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200507/1

Nov 13 '05 #3

First off, thanks for the responses.

I tried the suggestions - compact/repair and importing all objects to a clean
DB didn't help, and I have Access '97 so I can't compact on close.

Next, I thought that I must have missed closing an Object Variable. I found
the form that causes the instance to hang, but I've stepped through it about
20 times and even after setting all object variables to Nothing, I still
can't get the program to stop hanging.

Can you all think of anything else that could even remotely cause Access to
hang?
I'm really stuck on this one, it's driving me up the wall. Any further help
would be greatly appreciated.

Thanks in advance,

Nick
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200507/1
Nov 13 '05 #4

Well, it seems I may have found the cause:

I fixed this as a secondary issue, but as it turns out, I believe it was what
caused the program to hang.

When opening recordsets, I had a bad SQL statement; basically, for some
reason I used

"SELECT [Tbl - New Kits Progress].* FROM..."

instead of

"SELECT [Tbl - New Kits Progress].[Unicode] FROM..."

The second SQL doesn't cause the program to hang, but the first did. I don't
know if this was the main cause of more of an underlying cause, but thanks
for your all's help in narrowing down where the error was.

Thanks again,
Nick
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200507/1
Nov 13 '05 #5
"Nick via AccessMonster.com" <fo***@AccessMonster.com> wrote in
news:51***********@AccessMonster.com:

First off, thanks for the responses.

I tried the suggestions - compact/repair and importing all objects
to a clean DB didn't help, and I have Access '97 so I can't
compact on close.

Next, I thought that I must have missed closing an Object
Variable. I found the form that causes the instance to hang, but
I've stepped through it about 20 times and even after setting all
object variables to Nothing, I still can't get the program to stop
hanging.


It's not just a matter of setting to Nothing -- you have to close
the object beforehand, if it's appropriate. In the following code,
you need to close the recordset, but not the database:

Dim db As DAO.Database
Dim rs As DAO.Recordset

Set db = CurrentDB()
Set rs = db.OpenRecordset([SQL])
[do your thing]

rs.Close
Set rs = Nothing
Set db = Nothing

Why don't you need to close the db variable? Because the CurrentDB
can't be closed -- it's the open one in the user interface.

If, on the other hand, you opened, say, the back end MDB, then you'd
need to close it before setting it's variable to nothing.

Now, why must you close the recordset before setting its variable to
nothing? Because there are two completely different (though related)
memory structures involved. The database variable is a pointer to a
location in memory. When you set it to Nothing, you've cleared the
pointer, but you haven't necessarily released the memory it pointed
to (theoretically, it *should* be released, but it often isn't).
Closing the recordset releases the memory it was using. Then setting
the variable to nothing cleans up the pointer.

Keep in mind that there are also situations where you could have
implicit references left open, rather than explicit ones. I can't
think of a clear example, but if you go through all your code and
implement .Close where appropriate before setting to Nothing and
still have the problem, I'll try to come up with a better
explanation.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #6
"Nick via AccessMonster.com" <fo***@AccessMonster.com> wrote in
news:51***********@AccessMonster.com:
Well, it seems I may have found the cause:

I fixed this as a secondary issue, but as it turns out, I believe
it was what caused the program to hang.

When opening recordsets, I had a bad SQL statement; basically, for
some reason I used

"SELECT [Tbl - New Kits Progress].* FROM..."

instead of

"SELECT [Tbl - New Kits Progress].[Unicode] FROM..."

The second SQL doesn't cause the program to hang, but the first
did. I don't know if this was the main cause of more of an
underlying cause, but thanks for your all's help in narrowing down
where the error was.


Sounds fishy to me. The first is perfectly valid SQL. Yes, it
returns more columns, but that isn't relevant.

My guess is that by editing the module where that code existed, you
forced a recompile of something that was causing the problem.

You should read up on DECOMPILE. It's a very useful tool to prevent
VBA corruption from causing problems like this.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Vance Kessler | last post by:
I am sure this is a configuration or permissions problem, but I cannot figure out what it might be. I have 2 SQL 2000 database servers: one is a linked Windows 2003 based server using a...
1
by: szudor | last post by:
Hi, When I start db2cc, the program hangs with memory access violation in javaw.exe. Strating with trace option, in java trace file I found the following information: 0SECTION TITLE...
1
by: Setya Nugraha Djajadinata | last post by:
Hi all, I try to open an mdb and it gives error message : The database 'c:\MyDB\PDz.mdb' needs to be repaired or isn't a database file. You or another user may have been unexpectedly quit...
1
by: Ronny Sigo | last post by:
Hello all, I am trying to import the contents of an Excel sheet into my Access Database. When clicking the button excel opens allright and does what I programmed (the cells get updated with the...
11
by: Mr. Smith | last post by:
Hello all, My code can successfully open, write to, format and save several worksheets in a workbook then save it by a given name, close and quit excel. My problem is that if I try and do it...
8
by: mytfein | last post by:
Hi Everyone, Background: Another department intends to ftp a .txt file from the mainframe, for me to process. The objective is to write a vb script that would be scheduled to run daily to...
7
by: pat | last post by:
Group, I have a class that has properties: Private _lastUpdated as String Property lastUpdated() As String Get Return _lastUpdated End Get
1
by: TD | last post by:
I have the code below under a button on a form. At this point am just testing how to send email from MS Access. Access is installed on a machine running WinXP Pro. I checked the box next to...
4
by: MrDeej | last post by:
Hello! I have a complex .accdb database which i after yesterdays changes cannot enter the VBA anymore. Most of the forms and all tables/queries works fine. But one of the forms causes it to hang...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.