Hi and Season's Greetings to all.
I have a question regarding the use of a qualifier word "Global". I cannot
find any reference to this in Access help, nor in books or on the Internet.
"Global" seems to be recognised by Access in at least three cases:-
1) "Global Const". Recently someone in this group helped me resolve a
problem, and it involved the use of a Global Const. By Googling "Global
Const", I got plenty of hits -- but they were mostly just snippets of code
using this type of statement. Is there any difference between "Global
Const" and "Public Const"? If so, what is it?
2) "Global" variable. In an experiment, I found that I could replace "Dim"
(or "Public" or "Private") with "Global" in a variable declaration and it
would be accepted by Access VBA. Example -- instead of "Public x As
Integer" I typed "Global x As Integer". Again, is there any difference
between "Public" and "Global" in the variables context?
3) "Global Sub/Function". In another experiment, I entered into a module:
"Global Sub xxx()" and pressed ENTER. The compiler accepted this, but
automatically deleted "Global", leaving just "Sub xxx()". However, if I
replaced "Global" with some arbitrary "word" (eg: "Qaz Sub xxx()"), I got a
compiler error. So it seems that the compiler accepts "Global Sub" but
treats it like a "Public Sub" (which just "Sub" defaults to).
So my question is: what is it with "Global"? My guess would be that it is
an obsolescent form that is still supported for backwards compatibility.
This could explain why it is not documented anywhere that I could find. If
so, is it fully equivalent with "Public". If not, what exactly does
"Global" mean, and where can I find any documentation?
I am sure the gurus out there will know the answer to this!
--
Cheers,
Lyn.
I have a question regarding the use of a qualifier word "Global". I cannot
find any reference to this in Access help, nor in books or on the Internet.
"Global" seems to be recognised by Access in at least three cases:-
1) "Global Const". Recently someone in this group helped me resolve a
problem, and it involved the use of a Global Const. By Googling "Global
Const", I got plenty of hits -- but they were mostly just snippets of code
using this type of statement. Is there any difference between "Global
Const" and "Public Const"? If so, what is it?
2) "Global" variable. In an experiment, I found that I could replace "Dim"
(or "Public" or "Private") with "Global" in a variable declaration and it
would be accepted by Access VBA. Example -- instead of "Public x As
Integer" I typed "Global x As Integer". Again, is there any difference
between "Public" and "Global" in the variables context?
3) "Global Sub/Function". In another experiment, I entered into a module:
"Global Sub xxx()" and pressed ENTER. The compiler accepted this, but
automatically deleted "Global", leaving just "Sub xxx()". However, if I
replaced "Global" with some arbitrary "word" (eg: "Qaz Sub xxx()"), I got a
compiler error. So it seems that the compiler accepts "Global Sub" but
treats it like a "Public Sub" (which just "Sub" defaults to).
So my question is: what is it with "Global"? My guess would be that it is
an obsolescent form that is still supported for backwards compatibility.
This could explain why it is not documented anywhere that I could find. If
so, is it fully equivalent with "Public". If not, what exactly does
"Global" mean, and where can I find any documentation?
I am sure the gurus out there will know the answer to this!
--
Cheers,
Lyn.
Comment