Using global variables

R

Roy Goldhammer

Hello there

I have an ADP application that use global variables and objects comes from
class module who always runs.

On many case I can't point when the global variables and class module is
being deleted and it stuck my application

Is there Good way to dill with it?
 
S

Stefan Hoffmann

hi Roy,

Roy said:
On many case I can't point when the global variables and class module is
being deleted and it stuck my application
What do you mean with deleted? The class file missing or the variable
reset and the object free'd?
Is there Good way to dill with it?
If your object is a singelton, than use this kind of property in a
standard module:

Option Compare Database
Option Explicit

Private m_YourObject As YourObjectClass

Public Property Get YourObject() As YourObjectClass

If m_YourObject Is Nothing Then
Set m_YourObject = New YourObjectClass
' other init code...
End If
Set YourObject = m_YourObject

End Property

This will ensure that your object exists.


mfG
--> stefan <--
 
R

Roy Goldhammer

As you see the objects are being released, That include normal variables.

The thing you gave is good idea. But the data which inserted to this object
will be still deleted.

However, If I will use your way. and add terminate event will it the event
being done when the object is going to be release, so i can save the data on
database and not lose it?

Many of my objects are as part of form. Is form enough stable for holding
this data? can provide me all the data i need?
 
S

Stefan Hoffmann

hi Roy,

Roy said:
As you see the objects are being released, That include normal variables.
The thing you gave is good idea. But the data which inserted to this object
will be still deleted.
Of what kind of object are we talking about? Have you a custom class or
a standard form/report?
However, If I will use your way. and add terminate event will it the event
being done when the object is going to be release, so i can save the data on
database and not lose it?
Why can this object be terminated, ifyou need it over the entire runtime
of your application?
Many of my objects are as part of form. Is form enough stable for holding
this data? can provide me all the data i need?
I don't understand you. But the question still remains: what kind of
objects?


mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top