Access variable from form and module?
I have VBA code on forms and VBA code in modules - how do I make a variable
that they can both access? (Or how do I pass infomation between the two?) I want to have a module that has an open database function that I can reuse on different forms. (i.e save me copy pasting database open each time) and then return a variable - I can do this in c++, how do I do it in VBA? Many thanks in advance -- Thanks Parkin_m |
Access variable from form and module?
You need to declare the variable as public on an ordinary module, e.g. type
Public str As String at the top of a module in your project. This is then available throughout the project. "parkin_m" wrote: I have VBA code on forms and VBA code in modules - how do I make a variable that they can both access? (Or how do I pass infomation between the two?) I want to have a module that has an open database function that I can reuse on different forms. (i.e save me copy pasting database open each time) and then return a variable - I can do this in c++, how do I do it in VBA? Many thanks in advance -- Thanks Parkin_m |
All times are GMT +1. The time now is 09:44 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com