By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,609 Members | 1,164 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,609 IT Pros & Developers. It's quick & easy.

Simple Module/Variable Question

P: n/a
Hi,

a Simple Question, I have some code at my form, the code in the form is
calling a certain module and execute some code, a certain variable is set to
strTemp. but when de module is done. I still like to use that variable
strTemp in the code of my form ?

How ?
Thx
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies

P: n/a
As answered in microsoft.public.access.modulesdaovba. Please "cross-post"
not "multi-post" (I hope I didn't get them backwards). If posting to
multiple groups, post to them all simultaneously by listing all of them at
once in the "To" field. This way when someone replies, their replies go to
all of them at once also.
There are several ways to get the value back to your form.

1) Increase the "scope" of the variable by changing where you are declaring
it. If you declare it in the modules Declarations section you will make it a
"global" variable that is available throughout your application.

2) Use parameters passed ByRef (the default for VBA) when you call the
function. Assign the value of strTemp to one of these parameters. This will
change the value for the variable that correlates with that parameter when
calling procedure .

3) Have the routine in the module assign the value of strTemp to a control
on the form. You can then retrieve the value from that control when you
return to the form.

--
Wayne Morgan
Microsoft Access MVP
"TNGgroup" <tn*@tnggroup.com> wrote in message
news:3f***********************@news.skynet.be...
Hi,

a Simple Question, I have some code at my form, the code in the form is
calling a certain module and execute some code, a certain variable is set to strTemp. but when de module is done. I still like to use that variable
strTemp in the code of my form ?

How ?
Thx

Nov 12 '05 #2

P: n/a
I missed one.

4) Change your procedure from a Sub to a Function. Assign strTemp to be the
return value of the function.

--
Wayne Morgan
Microsoft Access MVP
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.