Don't Know How to Publicly Declare Variable 
Author Message
 Don't Know How to Publicly Declare Variable

I have Access 2000, and despite my knowledge base which is
pretty good I CANNOT figure out how to publicly declare a
variable so that it is used throughout the entire database.

I have browsed all through Google, and CANNOT find a
specific step-by-step procedure on how to do this. All I
can find is "declare it in the modules" but I can't find
**exact** syntax that is to be used. I have looked all
over the place for it, but can't find it. And attempts to
guess as it myself have proved fruitless.

Any tips?

LRH



Mon, 30 May 2005 06:25:23 GMT  
 Don't Know How to Publicly Declare Variable
Follow-up: here is a more specific explanation of the
problem.

I did type in the following code, verbatim, as a new
module (general module, not a form module):

Function stdeclarevariables()
Public stDetail As Double, stHeader As Double,
stFontDetail As Double, stFontHeader As Double
End Function

Then, in a function that I had execute from a customized-
right click, a value was set to stFontHeader and, with a
MsgBox line of code to check & see that it retained its
value, it had.

But!!......

Right after that, I had it run another function. The line
to do this was

Call savecolorpreferences

It's a standard module as well.

In the savecolorpreferences routine, I used a MsgBox again
to check & see if the value was retained. Wouldn't you
know it? The variable had lost its value and was null
again.

Why!!!!!   Grrr!!!!

LRH

Quote:
>-----Original Message-----
>I have Access 2000, and despite my knowledge base which
is
>pretty good I CANNOT figure out how to publicly declare a
>variable so that it is used throughout the entire
database.

>I have browsed all through Google, and CANNOT find a
>specific step-by-step procedure on how to do this. All I
>can find is "declare it in the modules" but I can't find
>**exact** syntax that is to be used. I have looked all
>over the place for it, but can't find it. And attempts to
>guess as it myself have proved fruitless.

>Any tips?

>LRH
>.



Mon, 30 May 2005 06:53:28 GMT  
 Don't Know How to Publicly Declare Variable

  Hi, if I understand you right. do this.

    At the begining of the module the line uder option
compare database type this

    Pubic {Variable name you choose} As what ever
interger / string

  hope this helps

Quote:
>-----Original Message-----
>I have Access 2000, and despite my knowledge base which
is
>pretty good I CANNOT figure out how to publicly declare a
>variable so that it is used throughout the entire
database.

>I have browsed all through Google, and CANNOT find a
>specific step-by-step procedure on how to do this. All I
>can find is "declare it in the modules" but I can't find
>**exact** syntax that is to be used. I have looked all
>over the place for it, but can't find it. And attempts to
>guess as it myself have proved fruitless.

>Any tips?

>LRH
>.



Mon, 30 May 2005 06:53:30 GMT  
 Don't Know How to Publicly Declare Variable

The Variables are declared as part of the function
stdeclarevaiables. To make them available to the module
you would place them outside of a function (Module level
variables). in the module header - simply Dim Var1 as
string. This allows every function in the module to
reference Var1.

To make this function Accessable to all modules simply
replace Dim with Public.

I use this vary same thing for handling a collection of
photos and displaying them 4 at a time with a flick
through them in a Load next unload Last -4 kind of way.

 Qi

Quote:
>-----Original Message-----
>Follow-up: here is a more specific explanation of the
>problem.

>I did type in the following code, verbatim, as a new
>module (general module, not a form module):

>Function stdeclarevariables()
>Public stDetail As Double, stHeader As Double,
>stFontDetail As Double, stFontHeader As Double
>End Function

>Then, in a function that I had execute from a customized-
>right click, a value was set to stFontHeader and, with a
>MsgBox line of code to check & see that it retained its
>value, it had.

>But!!......

>Right after that, I had it run another function. The line
>to do this was

>Call savecolorpreferences

>It's a standard module as well.

>In the savecolorpreferences routine, I used a MsgBox
again
>to check & see if the value was retained. Wouldn't you
>know it? The variable had lost its value and was null
>again.

>Why!!!!!   Grrr!!!!

>LRH

>>-----Original Message-----
>>I have Access 2000, and despite my knowledge base which
>is
>>pretty good I CANNOT figure out how to publicly declare
a
>>variable so that it is used throughout the entire
>database.

>>I have browsed all through Google, and CANNOT find a
>>specific step-by-step procedure on how to do this. All I
>>can find is "declare it in the modules" but I can't find
>>**exact** syntax that is to be used. I have looked all
>>over the place for it, but can't find it. And attempts
to
>>guess as it myself have proved fruitless.

>>Any tips?

>>LRH
>>.

>.



Mon, 30 May 2005 07:43:52 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Publicly declaring Dynamic Arrays at Module Level

2. Where to publicly declare record sets

3. Cannot assign a variable declared as a string to a variable declared as data type

4. Many Office97 Developer VBA declared procedures don't exist in 2000

5. Help-don't know what i'm missing

6. Don't know if i'm in the right newsgroup

7. Microsoft Windows 95 don't know calculation

8. Migration to VS 2003 worked though I don't know why

9. Don't tell me no one knows the answer

10. does anybody know why this code don't work

11. Importing files-don't know please help.

12. Don't know how to print Invoice with DATAreport

 

 
Powered by phpBB® Forum Software