Setting value of a public var from a form

  • Thread starter Thread starter Dave D
  • Start date Start date
D

Dave D

I need to pass the value entered on a form to a variable
in a module, have tried severial times and no joy. The
variable in the module I am trying to set is public, the
form item is a textbox. I am using the on exit event.
 
Doesn't

myVar = Textbox1.Text

not work?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
No it does not, I have tried from the form ti set the
value and from the module to set the value. Could it be
the "private" declaration of the event?
 
The variable should be declared Public at the top of the general module,
before any procedures and not within a procedure and not in the code module
associated with the form.
 
Doing it from a form should be no problem as long as the variable is in a
standard code module.

Doing it from the module would need

myVar = Userform1.Textbox1.Text

and the form must not have been unloaded.


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top