matt beamish
Registered User.
- Local time
- Today, 11:26
- Joined
- Sep 21, 2000
- Messages
- 215
How to use value from form as Global/public variable
I want to use several values entered in form controls as variables within multiple subs triggered by further form edits.
I do not want to define the variables in each sub as this will bloat my code, but I am not being successful in declaring my variables outside of an individual sub, and it is the 'Form!' reference that is throwing it I think.
Here are my variables:
If I put these at the top of a module I get an "invalid outside procedure" error message.
If I put these in their own module as 'Public' I get the same error.
Any advice on how within a forms code module I can make these variables available to as many events as I like?
thanks
I want to use several values entered in form controls as variables within multiple subs triggered by further form edits.
I do not want to define the variables in each sub as this will bloat my code, but I am not being successful in declaring my variables outside of an individual sub, and it is the 'Form!' reference that is throwing it I think.
Here are my variables:
Code:
Dim limit0txt, limit1txt, limit2txt, limit3txt As Integer
limit0txt = Forms!F_Samples_CF_FF_FLot!SF_EnviroCountLimitscntrl.Form!Limit0
limit1txt = Forms!F_Samples_CF_FF_FLot!SF_EnviroCountLimitscntrl.Form!Limit1
limit2txt = Forms!F_Samples_CF_FF_FLot!SF_EnviroCountLimitscntrl.Form!Limit2
limit3txt = Forms!F_Samples_CF_FF_FLot!SF_EnviroCountLimitscntrl.Form!Limit3
If I put these at the top of a module I get an "invalid outside procedure" error message.
If I put these in their own module as 'Public' I get the same error.
Any advice on how within a forms code module I can make these variables available to as many events as I like?
thanks
Last edited: