Rabu, 08 Mei 2013

[MS_AccessPros] Re: disappearing global variables

 

Greeetings, Onno, or Knol,

Access may one day be used to prove the existence of parallel universes (or at least parallel Glob(al)s) as the Global "variables sometimes seem to live up to their name and vary their "global" context.

TempVars seem to be longer lived and so far I haven't had a TempVar disappear down a Wormhole in space but, I'm not betting on it and will implement somehting like John/Bill's Ideas for TempVars as well, in time.

I never found a definite pattern as to when Global Variables would desert this world for a better one but it did happen, occasionally, before or after the processing of a commandbar called VBA Routine, even in a "compiled" .mde

My solution was a bit more "sledgehammer" than Bill or John provide and at the beginning of a routine using a "global" "variable" I check one particular variable and if it has lost its value I either exit the application or call a variable-initialising routine (depending on the context or severity of the possible loss.) Something like:

If Len(globSentryString) = 0 Then
LogInternalError "Internal Error: Global Context lost"
GetWorkstationSettings()
End If

(Whereby the Error string to log is actually a global constant which, until now, have never left me with an empty heart, erm, object/string)

--- In MS_Access_Professionals@yahoogroups.com, "Onno Knol" <onno.knol@...> wrote:
>
> Dear Friends,
>
> In my MsAccess application I define a number of global variables, like paths where I want to store files.
> Now it sometimes happens that these gobal variables disappear somewhere in the process of working with the application. Then my files suddenly are stored on unexpected places like the root directory. What can be the cause? A memory leak? And more important, how can I trace where this happens? Until now it seems like a random phenomenon.
>
> Has anyone ever had this problem and how did you handle it? One alternative is to stop using global variables and read-write them to a database table called settings,but I think this will be slower.
>
> Any thoughts would help.
>
> Thanks, Onno Knol
>

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (7)
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar