PC Review


Reply
Thread Tools Rate Thread

Clear Global Variable

 
 
Aaron Reid
Guest
Posts: n/a
 
      24th Feb 2010
I have eight different global variables that make calculations based on
information on the underlying form. I need these variables to empty and
recalcuate (variable1 - varibale2) as the information on the form changes.
My code works as it should but keeps the previous data when doing the new
calculation.

How to I clear all the variables?


 
Reply With Quote
 
 
 
 
Jeff Boyce
Guest
Posts: n/a
 
      24th Feb 2010
Aaron

I'm confused ...

A "global" variable would be one that is ALWAYS the same ... hence,
"global".

It sounds like you want to compare two values in a specific record (?shown
on a form?). Why not just add a textbox on that form to do the calculation?
Or even easier, do the calculation in a query and use that query to "feed"
the form.

More info, please...

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"Aaron Reid" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have eight different global variables that make calculations based on
>information on the underlying form. I need these variables to empty and
>recalcuate (variable1 - varibale2) as the information on the form changes.
>My code works as it should but keeps the previous data when doing the new
>calculation.
>
> How to I clear all the variables?
>



 
Reply With Quote
 
Tokyo Alex
Guest
Posts: n/a
 
      25th Feb 2010
Hi Aaron,

Global variables are available to all procedures in all modules in your
project. Their values are maintained until changed by code, the app stops
running or the project is reset.

To clear them, therefore you will need to do something like:
gstrMyGlobalStringVariable = ""
gintMyGlobalIntegerVariable = 0
......

If you need to clear the variables every time a particular procedure runs
(my understanding of your question), then I think it's likely you don't
really want global variables. Local variables (defined in a certain
procedure) are automatically cleared when the procedure finishes.

Hope this helps,
Alex.


"Aaron Reid" wrote:

> I have eight different global variables that make calculations based on
> information on the underlying form. I need these variables to empty and
> recalcuate (variable1 - varibale2) as the information on the form changes.
> My code works as it should but keeps the previous data when doing the new
> calculation.
>
> How to I clear all the variables?
>
>
> .
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? Daniel Microsoft Excel Worksheet Functions 1 9th Jul 2005 03:05 AM
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? Daniel Microsoft Excel Discussion 1 9th Jul 2005 01:04 AM
Still not clear about global functions Alan Silver Microsoft ASP .NET 14 21st Jun 2005 11:41 PM
Re: global variable Ignacio Machin \( .NET/ C# MVP \) Microsoft C# .NET 0 16th Sep 2004 09:28 PM
how to set a 'global' variable in global.asax Jason Shohet Microsoft C# .NET 2 19th Apr 2004 08:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:33 PM.