Rabu, 24 Oktober 2012

Re: [MS_AccessPros] Re: global variable persistence

 

Hi Liz,

did you see my post to Connie about TempVars?
__________________________________
use TempVars or database properties, they don't get lost when errors happen like global variables do

TempVars are easier to use but get lost when the database is closed.  Database properties are kept.

__________
TempVars

in VBA:
TempVars.Add "tvVariableName", value

if the tempvar already has a value, it will be changed

you can retrieve the value like this:

TempVars!tvVariableName
or this:
TempVars("tvVariableName")
__________________________________

tempvars can be used directly in queries too (ie: Criteria, Field), so they are a convenient place to store information you only need while the database is open

Warm Regards,
Crystal

Microsoft MVP, Access
remote training and programming

free book, tips, and tools:
http://www.AccessMVP.com/strive4peace

free video tutorials:
http://www.YouTube.com/LearnAccessByCrystal , http://www.YouTube.com/LearnByCrystal

free downloads:
http://www.rogersaccesslibrary.com/forum/long-crystal_forum71.htm

 *
   (: have an awesome day :)
 *

________________________________
From: borninfulton <rfalanga@unm.edu>
To: MS_Access_Professionals@yahoogroups.com
Sent: Wednesday, October 24, 2012 9:10 AM
Subject: [MS_AccessPros] Re: global variable persistence

Unless I'm seriously mistaken, when you stop your VBA apps from running in MS Access, then the data in global variables aren't guarenteed to persist.  They only retain their values, so long as the VBA app is running.

Rod

--- In MS_Access_Professionals@yahoogroups.com, Liz Ravenwood <liz_ravenwood@...> wrote:
>
> Pros, is there anything I'm missing with a particular global variable not persisting?  I'm debugging and working through errors and then when I fire up my testing again, the variable has lost its value.
>
> This is in the declarations section of a module:
>
> Option Compare Database
> Option Explicit
>
> Global booAccess As Boolean
> Global strWho As String
>
> The global booAccess is in a previously released version of the database and I have had no reports or problems with that one persisting, so I'm wondering if it's because I get errors and there is some type of flush.
>
> ?
>
> Liz Ravenwood
> Programmer/Analyst
> Super First Class Products
> B/E Aerospace
> O: 1.520.239.4808
> www.beaerospace.com<http://www.beaerospace.com>
>
> This email (and all attachments) is for the sole use of the intended recipient(s) and may contain privileged and/or proprietary information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
>

------------------------------------

Yahoo! Groups Links

[Non-text portions of this message have been removed]

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

__,_._,___

Tidak ada komentar:

Posting Komentar