p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Access (http://p2p.wrox.com/forumdisplay.php?f=18)
-   -   Static vs constant (http://p2p.wrox.com/showthread.php?t=6980)

stoneman December 8th, 2003 01:38 AM

Static vs constant
 
What is the difference between declaring something as Static vs declaring the same thing as a constant?
When does one use one over the other

 Eg

Static msg as String
msg= Save Changes

Versus

Const msg as String = "Save Changes"

Thanks

edcaru December 10th, 2003 03:33 PM

A static variable in a procedure holds the value even after the procedure ends. Variables have a scope, which means that it can be accessed through the whole module if it is a module level variable, or through the whole procedure in which it is defined.
When the procedure ends the variable loses its value if it is not a static variable.
Variables can hold different values but constants are used to represent a constant value.

Steven December 10th, 2003 09:12 PM

It's got something to do with constants being constant and variables being variable - you can't vary a constant, but you can vary a variable

I am a loud man with a very large hat. This means I am in charge


All times are GMT -4. The time now is 02:59 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.