Issue with labels

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello everyone,

We have an Access 2002 application that has a single form that is accessed
from a single PC. The purpose of the application is to continually process
some data for the company as if it were a service. For the most part the
application runs fine for a day or two then odd errors begin to appear. If I
end the code, close the database, and restart it everything is fine again for
a while.

The most common error is error 5 ("Invalid Property Assignment"), it occurs
when the code attempts to assign a labels caption like this:

for outerloop = 1 to somecount
lblTest.caption = ""
for innerloop = 1 to someothercount
lblTest.caption = lblTest.caption & " more text."
next innerloop
next outerloop

if in debug mode, I set the labels caption to "" then run the code
everything is fine. Once this code gets into this state any caption
assignment to any label that follows the same convention is affected.

I am sure that this error is a red herring and that there is another issue
at hand. We recieve this error weather the database is compiled into an mde
or a plain mdb. The error is not predictable or easily reproducable and a
restart of the application seems to correct the problem for a while.

I think that I will need to use an interim string variable to hold the
caption value then reassign the value to the caption like this:

dim sTemp as string

for outerloop = 1 to somecount
lblTest.caption = ""
for innerloop = 1 to someothercount
sTemp = ""
sTemp = lblTest.caption & " more text."
lblTest.caption = sTemp
next innerloop
next outerloop


There quite a few labels on this form and a number of places where
assignments are set. I was hopeing that someone has encountered this before
and point me into the direction to figure out what is going here. Granted
Access may not have been the most ideal solution for this application but it
is what I have inherited and it is a mammoth project for porting anywhere
else, so in the meantime, I need to stabilize.

Thanks in advance,

Matthew
 
If basic code like this fails only after several days of operation, you are
probably looking at some kind of memory leak.

The leak may not be directly related to the code. For example, it could be
caused by the repeated opening and closing of objects such as forms or
reports. There was a memory leak associated with the Picture property of
forms/reports, so if you are using that property, you may want to remove the
background picture and see if it helps. There is reportedly a leak with ADO
recordsets as well, if you are using those. With all objects (including DAO
recordsets, ADO recordsets, and so on), it is important to close what you
open.

The fact that the issue occurs in an MDE rules out corruption of the
project. The restart releases the leaked resources of course.

I'm not aware of any leak related to assigning properties, but you could try
modifying your code so that it only changes things that need to be changed
(i.e. read the property first, and change only if it is not already the
desired value).

Not sure that covers your broad question. Perhaps others can contribute as
well.
 
Back
Top