Hi Liz,
thanks :) adding on to what Bill said ...
in addition to being new with 2007, TempVars can also be set and used by macros, which is probably why they got added
here is how to remove a TempVar:
TempVars.Remove "tvName"
btw, DesertCodeCamp is coming up in November ... I won't be there but maybe you want to volunteer to do a presentation? Signup here:
http://nov2012.desertcodecamp.com/
once the speakers are set, the site will be at desertcodecamp.com
Warm Regards,
Crystal
*
(: have an awesome day :)
*
________________________________
From: Bill Mosca <wrmosca@comcast.net>
To: MS_Access_Professionals@yahoogroups.com
Sent: Wednesday, October 24, 2012 11:22 AM
Subject: RE: [MS_AccessPros] Re: global variable persistence
Liz
TempVars are fairly new. They are not available in 2003. Global variables only
lose their values if an unhandled error occurs in a non-compiled database such
as an MDB or ACCDB. If you use an MDE or ACCDE the value is not lost. And there
is slightly less coding with globals than with TempVars. And Intellisense does
not show the names so you have to remember them as you code.
But by all means experiment with them. You might find you like them better.
Regards,
Bill Mosca,
Founder, MS_Access_Professionals
That'll do IT <http://thatlldoit.com/> http://thatlldoit.com
MS Access MVP
<https://mvp.support.microsoft.com/profile=C4D9F5E7-BB03-4291-B816-64270730881E>
https://mvp.support.microsoft.com/profile=C4D9F5E7-BB03-4291-B816-64270730881E
My Nothing-to-do-with Access blog
<http://wrmosca.wordpress.com> http://wrmosca.wordpress.com
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Liz Ravenwood
Sent: Wednesday, October 24, 2012 9:27 AM
To: 'MS_Access_Professionals@yahoogroups.com'
Subject: RE: [MS_AccessPros] Re: global variable persistence
So, knowing this, (haven't run with it yet) -- why would we want global
variables instead of the TempVars then?
Liz Ravenwood
Programmer/Analyst
Super First Class Products
B/E Aerospace
O: 1.520.239.4808
www.beaerospace.com
-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
[mailto:MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com> ] On Behalf Of Liz Ravenwood
Sent: Wednesday, October 24, 2012 9:19 AM
To: 'MS_Access_Professionals@yahoogroups.com
<mailto:%27MS_Access_Professionals%40yahoogroups.com> '
Subject: RE: [MS_AccessPros] Re: global variable persistence
Wow. Thanks Crystal. Honestly I don't know how you have the time to help out so
many people and still develop yourself. I have so many projects and people want
me to "teach them" and I feel bad cause I cop a bit of an attitude because I
don't want to get trapped in this spoon feeding business when I still have so
much I need to learn.
You impress me. I think you have clones or don't need sleep or something. :-)
Liz Ravenwood
Programmer/Analyst
Super First Class Products
B/E Aerospace
O: 1.520.239.4808
www.beaerospace.com
-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
[mailto:MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com> ] On Behalf Of Crystal
Sent: Wednesday, October 24, 2012 8:50 AM
To: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.com>
Subject: 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 <mailto:rfalanga%40unm.edu> >
To: MS_Access_Professionals@yahoogroups.com
<mailto:MS_Access_Professionals%40yahoogroups.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
<mailto:MS_Access_Professionals%40yahoogroups.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.
>
[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 (11) |
Tidak ada komentar:
Posting Komentar