I often combine Public variables with a table and use a wrapper function. The function checks to see if the variable is set, and if not, it loads it from the table and returns it. If the variable is set, it simply returns the value and avoids the overhead of loading again.
I don't remember that discussion, but I'll weigh in with what I do.
My users get MDEs or ACCDEs. Those will not lose the variable value when an error happens. Secondly, The problem only comes up when the error is not handled with an error trap.
Liz's idea is a good one but if you go that route why not just use a table. Retrieving the value could be done with a domain aggregate. DLookup("myValue", "myVarTable", "MyVariable = 'UserGroup'")
Regards,
Bill Mosca, Founder - MS_Access_Professionals
Microsoft Office Access MVP
http://mvp.microsoft.com/en-us/mvp/Bill%20Mosca-35852
My nothing-to-do-with-Access blog
---In MS_Access_Professionals@yahoogroups.com, <zctek@aol.com> wrote:Hi All,Many months ago there was a discussion re. holding Global Variables in a Class Module being preferable to holding them in a standard Module because in the event of an error, the Variables could lose their value.If that is true then I would like to see and example of a Class Module holding one or more Global Variables.I would appreciate any help. I am using Access 97, 2003, and 2007.Regards, Clive.
| Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (5) |
Tidak ada komentar:
Posting Komentar