How to sse value from form as Globall variable

jeudi 16 avril 2015

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

How to sse value from form as Globall variable

0 commentaires:

Enregistrer un commentaire

Labels