Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 8th, 2003, 01:38 AM
Authorized User
 
Join Date: Jun 2003
Location: , , .
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
Reply With Quote
  #2 (permalink)  
Old December 10th, 2003, 03:33 PM
Authorized User
 
Join Date: Nov 2003
Location: Paola, Europe, Malta.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
Reply With Quote
  #3 (permalink)  
Old December 10th, 2003, 09:12 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Melbourne, Vic, Australia.
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
C# constant functions viveksrivastava C# 4 December 6th, 2007 10:44 PM
Constant pointer and pointer to a constant amit_mande@yahoo.com C++ Programming 2 June 5th, 2007 01:39 AM
non-static reports to static html files miamikk ASP.NET 2.0 Basics 0 June 4th, 2007 01:48 PM
Constant in VBScript savoym VBScript 2 May 18th, 2005 06:53 AM
Backend as a constant Steven Access 1 June 29th, 2003 11:49 PM



All times are GMT -4. The time now is 06:36 AM.


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