Accessing a variable value in another code module

wdegler

Active Member
Licensed User
Longtime User
I have the feeling the following problem is TOO easy for me to see.
Here is my simplest example of the problem:

In my Activity module:

Sub Process_Globals
Dim X as String
End Sub

Sub Activity_Create(FirstTime As Boolean)
X="A"
End Sub
********************************
In my "Mod" code module:

Sub MySub
MsgBox(X,"")
End Sub

******************************
The message box doesn't know that X ="A".
It does not help to add

Sub Process_Globals
Dim X as String
End Sub

to the "Mod" module.

I can access subs in other modules but not values of variables.
What is needed?
 
Correction to this codeI have the feeling the following problem is TOO easy for me to

I have the feeling the following problem is TOO easy for me to see.
Here is my simplest example of the problem:

In my Activity module:

Sub Process_Globals
Dim X as String
End Sub

Sub Activity_Create(FirstTime As Boolean)
X="A"
Mod.MySub
End Sub
********************************
In my "Mod" code module:

Sub MySub
MsgBox(X,"")
End Sub

******************************
The message box doesn't know that X ="A".
It does not help to add

Sub Process_Globals
Dim X as String
End Sub

to the "Mod" module.

I can access subs in other modules but not values of variables.
What is needed?
 
Upvote 0
That is all I needed!

Thank you AGraham; this works!
I just know that Activity.X didn't work.
I also discovered that "Mod" is a reserved word.
I can now proceed ...
 
Upvote 0
Back
Top