Hello everyone,

I am trying to set a global variable in a module so that I can call it from any form or command button. I thought that I would declare the vairable by "public x as double" then set "x = 45" But how do I use "x" in another form

Thanks for the help!

CW

First off make sure the name is unique. then declare it as public outside of any sub or function, then use it like any variable.

A little trick I found helpful is include capitals in the variable name. that way when I'm coding, if the name doesn't change I typed it wrong or I don't have access in that code.

You're welcome. Don't forget to mark this solved if it is. thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.