M
Me
I have a need to store results of a query in global variable for
later use.
I created a module with function as
Function GetMyVariable() As String
GetMyVariable = strMyvariable
End Function
I also tried with the following code -
Function GetMyVariable(strMyvariable) As String
GetMyVariable = strMyvariable
End Function
I created a form that calls the query
In the form, I have
Private Sub Form_Open(Cancel As Integer)
strMyvariable = Forms!CurrentUser!Myvariable
GetMyVariable (strMyvariable)
MsgBox ("form my variable") & strMyvariable & " var " &
GetMyVariable(strMyvariable)
shows me the values correctly.
However, I created another form wherein I try to retrieve the value of
strMyvariable, it doesn't show anything.
I even put the following display to see the values
MsgBox ("form my vraible") & strMyvariable & " var " &
GetMyVariable(strMyvariable)
What am I doing wrong?
Thanks for your help!
-Me
later use.
I created a module with function as
Function GetMyVariable() As String
GetMyVariable = strMyvariable
End Function
I also tried with the following code -
Function GetMyVariable(strMyvariable) As String
GetMyVariable = strMyvariable
End Function
I created a form that calls the query
In the form, I have
Private Sub Form_Open(Cancel As Integer)
strMyvariable = Forms!CurrentUser!Myvariable
GetMyVariable (strMyvariable)
MsgBox ("form my variable") & strMyvariable & " var " &
GetMyVariable(strMyvariable)
shows me the values correctly.
However, I created another form wherein I try to retrieve the value of
strMyvariable, it doesn't show anything.
I even put the following display to see the values
MsgBox ("form my vraible") & strMyvariable & " var " &
GetMyVariable(strMyvariable)
What am I doing wrong?
Thanks for your help!
-Me