p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   VB How-To (http://p2p.wrox.com/forumdisplay.php?f=78)
-   -   How to set a global variable? (http://p2p.wrox.com/showthread.php?t=10583)

Ciarano March 16th, 2004 08:16 AM

How to set a global variable?
Hi guys

When connecting for the first time, I want to hold the details of the database in global variables that can be accessed accross multiple modules, I know I can create public variables within a module but how do it do it across modules?

Many thanks for any help here!



xgbnow March 16th, 2004 08:58 AM

If you create a public variable in a module (bas) you will be able to access that variable from anywhere within your project. Most of the time I use a global connection object.

Public gCn As ADODB.Connection

I then use a function in a dll/class module to connect to the database I pass the global connection object as a parameter.

Hope this helps.

Larry Asher

Ciarano March 16th, 2004 01:51 PM


Thanks for your help



All times are GMT -4. The time now is 08:49 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.